From patchwork Tue Oct 27 13:00:22 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5514 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:6a4:b0:8dd:1f3c:c7c4 with SMTP id i4csp131570maw; Tue, 27 Oct 2026 06:00:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBzvgoivOFaI7qtbvsMeiU9JZ10Fjf3jiyRzWEkceJPGmIZQ1+qkaDqI9/5TdSqSAnuS7wczX0PxHRo=@openvpn.net X-Received: by 2002:a05:6808:5091:b0:53f:4cb6:cda8 with SMTP id 5614622812f47-55c0023e171mr6204120b6e.23.1793106048613; Tue, 27 Oct 2026 06:00:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1793106048; cv=none; d=google.com; s=arc-20260327; b=Qd6qMn4iCd9Hpkf5IGcmi0bYVNCnNYIOxzZ0w32L/H9vjSICYA+tjz/WnaBL9AO+vj nBKfOs/K209VxQ+fKLUiXz5GZ8oMSz4tE3tkCTxU7VfcKprSyFIUVVs7qwbsVjpT8gk8 2lQA0QYYLHCYfOTVzFSO0PM5RqZYF/Znke3wrUFlSdVi1r7zXRy2BJB6M8h831DF6Fap gz07+/TrYAKCmvXVS3auXq1XQ8QeF72nfEQwlm24OTbpeBZjiXgG3rlOuXI93lGbJ+9D 7JI998euV7zkeu2ZdFEXL4GWiPSQ/vcKmu6G3y75V9umKIoJ2lE4uGHPfU+t0R3B94vu hRJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=F4d4BIBh9k+QKEbAh1gSDml5us0SD4W5fmMpTGEVEsI=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=YwZeXlVLXL/1OskCzhLttf9LxqkGnjT43b0f/KJV4fVDdVZFQBXZfO9iyiqNZMP1NS WOVU0uBCe1ekvCdRzaDbiOR34CwcCef7pc5VhHd9Ela7e3/xofufE6Z5oUio5WOCW2Ui RcQsznnb7BAdrOc0LspEO04y9ktHtel7k+mbYQaAcSW+3PQxyhWLjItkSIT+iiusKdsV /MTDNv7qJ651WlBF1vB/XN2vRLKG72uoroe2IFPlt5DK9Z5DckCXBNgy6zSBVN/A/dYG /NncH/yRs06xQbYgp9fdtk4hnof6rfYRargwg4d9/ts0eB5kRm7B3frZ7SYUMoh56Mqv 2x9g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=leLa4OLz; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=ctSpaY0W; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="H0/kWgLV"; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 5614622812f47-55c0443313esi13524705b6e.104.2026.10.27.06.00.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Oct 2026 06:00:48 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=leLa4OLz; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=ctSpaY0W; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="H0/kWgLV"; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=F4d4BIBh9k+QKEbAh1gSDml5us0SD4W5fmMpTGEVEsI=; b=leLa4OLzbzVJAy LWK50NZ6hLg7o0Ij62B3E2bebJ+asWTqQOViwrQpkbmzkQnvPdS1g2A5HnTIMK3Z+YukuCUiaJ1EM 6rosf9Nt14qDq933DGEAdAfwiWb7OHyz0UKlpulCVvsuy9bRkqxKhcudKtuyoOdUTA0ZsIeuE0Gqe JCk=; Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.100.1) (envelope-from ) id 1xLgnB-0000000010g-3jfH; Tue, 27 Oct 2026 13:00:41 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xLgnA-0000000010X-32ia for openvpn-devel@lists.sourceforge.net; Tue, 27 Oct 2026 13:00:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive; bh=PcaeUt9Ni033okFEhsKPlh+oHHVbIOsL9byL4CCXoIA=; b=ctSpaY0WEI1PPhvIArZFWB1FxN aGZkvReX+ETJja/o7e09bVQBDx6shkS7iaYoEwZcAB9n68HazCWKeJsL+bf9zQrdAXAzzyVglbgyv NKP6/giWoVPuu0yEf9F/p2ZjUYTwXx9YYofmb6m2b5hm/ctwSvjIwLJ1hyc18UqwWgEQ=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Unsubscribe-Post: List-Subscribe:List-Post:List-Owner:List-Archive; bh=PcaeUt9Ni033okFEhsKPlh+oHHVbIOsL9byL4CCXoIA=; b=H0/kWgLVDeh24QJY9s3sh9bm4U aU5r3SgYzPFVdtH3ySqOjq/OOX1EfrQDnhJURDBUfIluvmJwsmmyXmZpLALDlfw8RKZ2INKnMEWi6 PvtGHUbaWwRjFNSg1x8ne9kw/+Hf9TNUsq0tE/igIksEnJhlg2zWRAfEC++XyMY4hd6E=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1) id 1xLgn5-000000006lv-4BYd for openvpn-devel@lists.sourceforge.net; Tue, 27 Oct 2026 13:00:37 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 69RD0Sob002241 for ; Tue, 27 Oct 2026 14:00:28 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 69RD0SCo002240 for openvpn-devel@lists.sourceforge.net; Tue, 27 Oct 2026 14:00:28 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 27 Oct 2026 14:00:22 +0100 Message-ID: <20261027130028.2220-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.55.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Heiko Hund GetFullPathNameW() returns the required buffer size if the normalized path doesn't fit. This case is currently not checked, so a normalized path longer than MAX_PATH left the buffer empty and the plug [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [193.149.48.129 listed in list.dnswl.org] 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1xLgn5-000000006lv-4BYd Subject: [Openvpn-devel] [PATCH v1] plugin: detect too long plugin paths on Windows X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: 1880207967599210673 X-GMAIL-MSGID: 1880207967599210673 From: Heiko Hund GetFullPathNameW() returns the required buffer size if the normalized path doesn't fit. This case is currently not checked, so a normalized path longer than MAX_PATH left the buffer empty and the plugin was then rejected with the misleading message that it is not located in a trusted directory. Treat a return value that does not fit into the buffer as failure, so that the error says that the path could not be normalized. Since GetFullPathNameW() sets no error code, set ERROR_FILENAME_EXCED_RANGE manually before logging. Change-Id: Ib40b439ad84a08fe6d5d4407da18ed78151327e7 Signed-off-by: Heiko Hund Acked-by: Frank Lichtenheld Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2039 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2039 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld diff --git a/src/openvpn/plugin.c b/src/openvpn/plugin.c index a94f07b..9826510 100644 --- a/src/openvpn/plugin.c +++ b/src/openvpn/plugin.c @@ -284,8 +284,14 @@ WCHAR *wpath = wide_string(p->so_pathname, &gc); WCHAR normalized_plugin_path[MAX_PATH] = { 0 }; /* Normalize the plugin path, converting any relative paths to absolute paths. */ - if (!GetFullPathNameW(wpath, MAX_PATH, normalized_plugin_path, NULL)) + DWORD len = GetFullPathNameW(wpath, _countof(normalized_plugin_path), normalized_plugin_path, NULL); + if (len == 0 || len >= _countof(normalized_plugin_path)) { + /* GetFullPathNameW() sets no error code if the buffer is too small */ + if (len != 0) + { + SetLastError(ERROR_FILENAME_EXCED_RANGE); + } msg(M_ERR, "PLUGIN_INIT: could not load plugin DLL: %ls. Failed to normalize plugin path.", wpath); }