From patchwork Tue Oct 27 13:00:49 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5515 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:78dc:b0:8dc:5c83:a4ec with SMTP id e28csp145455max; Tue, 27 Oct 2026 06:01:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBx0QsKVj4wVyxS0zqTXEkYCJb5eKp9NNNsHw6UgudjChx8WRbWwff2XS9OLTLxZmLNkai11al2UR+M=@openvpn.net X-Received: by 2002:a05:6808:1b0c:b0:4b9:a88b:888e with SMTP id 5614622812f47-55c0028c68cmr6260844b6e.36.1793106072317; Tue, 27 Oct 2026 06:01:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1793106072; cv=none; d=google.com; s=arc-20260327; b=RKpP6YV3AU5qTqi30Sj1fvJwRW6DiuGSD7I2AGN3Drb8a8THNFmT5u2V5eTwesrKjs pgHaVIW6zLBmaq3uPrh5kgVj56KwEHjI+thIKhifybTb+8kWSH45RkwzQ2wqQ/ukmNer Q+7i9Mlr6opaxFbXmRLDFNk22vsyk5evGLmns3XzPGFykeBVbzlpaQu7vR1XUSsN79bw F9zp4jwmVNHu8StANpb8VSkWD9fSNXHdrAjREzC8bg4trlsbs1a/7Ann1MRlls4ZoP3y KMuys7BSYabJK82JnWURIh5GhIrB+zJZ5BspUyv9/ffgU4i22AlmpUqUefXZ4005fVjt ShsQ== 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=237TN/78rwTJTGgJpeWwE/b1b0hjuF0puXt3iKqOB8Y=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=csNaV/lcg6h++BET8rpTuS0xt2oWghBIDdOGVqY7Yzp0sINb5ceQ0+cVZCz+9cRTrU v3ibMel33GRg9PNYJMDqykW7WROX/3QTEdOBWi9eYL5JuBcNZqvNhG/UkMtqik9BWxsX HFP/NEkr0MBeHwc3c0buMyNaoa0zNQniM4fr9pW3vAHWerH0zcM7y2SMMeUb8anoTn7/ wHAXao+DNUeLwtYHx4pbxLOus6/4BTC6KZ3LQytyxa0PRuY3zQ2FBr6iOTi64AgSEcvC MdlITw/pGJtpMNjUV6XWUW9P5JUBjeYMyLv1iURPy1FempQRdONqK8ri7QuuA/czMrrT Si+A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=XCZD+CLl; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=ZHymj1K6; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=WPFBgPaA; 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 586e51a60fabf-4a8431ef100si12918505fac.114.2026.10.27.06.01.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Oct 2026 06:01:11 -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=XCZD+CLl; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=ZHymj1K6; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=WPFBgPaA; 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=237TN/78rwTJTGgJpeWwE/b1b0hjuF0puXt3iKqOB8Y=; b=XCZD+CLlq23rH1 eW/vv1lV262x59UfzovXxNvKiQmLCMOqLtxHSYptG/y02AtocpuA6/6roUdfYTkNxo9buExrWKA1w i3409mMfqU993fhAJCq9KaxF6fevua82+JPqPbVH8tK6l9MITcsuAUrpHUj9OiTyJe6xKaAxsXf1L IPw=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.100.1) (envelope-from ) id 1xLgna-000000002ov-0pZD; Tue, 27 Oct 2026 13:01:06 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xLgnY-000000002on-22Wx for openvpn-devel@lists.sourceforge.net; Tue, 27 Oct 2026 13:01:04 +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=SGyluH2f09RHo/h/xNgQ5N+XjZh9kLefJ4L4BMzMTC8=; b=ZHymj1K68n/wfryU8rKnPn8fRQ SKhz8RQ/Ji36I+0LTv2tI9+jeQTSHFqX+zj9hTVwPocGLPxrrJLtSAh64RX4vn8uApL2R93yf/DuQ DJkPdRieoNIy4DjqZkFJFUVV5sJc0oPYQGarafg5327JXiQh6ym3ptQT5QbkSWmy42gQ=; 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=SGyluH2f09RHo/h/xNgQ5N+XjZh9kLefJ4L4BMzMTC8=; b=WPFBgPaAlMaZGr+dJQq4w7SVR8 KYvjFEHYO5EjrqxHwZIBzHgUH/py1czqIGQ0+S4RQQdqYHuypQ3zCbSZZJEOVeafxt7rgtrG/EJxb njOOi+kV2G1wqsjjs0qHFe7QgxIWBgqVdDR5xx+IZ5jzEKhmDBk0vSitM6l3SsVKWGmU=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1) id 1xLgnV-000000006EX-2a3K for openvpn-devel@lists.sourceforge.net; Tue, 27 Oct 2026 13:01:04 +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 69RD0skT002302 for ; Tue, 27 Oct 2026 14:00:54 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 69RD0sXT002301 for openvpn-devel@lists.sourceforge.net; Tue, 27 Oct 2026 14:00:54 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 27 Oct 2026 14:00:49 +0100 Message-ID: <20261027130054.2283-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-1.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 get_openvpn_reg_value() expects the size of the value buffer in bytes, as documented and as RegGetValueW() expects it. All callers passed the number of characters instead, so only half of the buffer w [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1xLgnV-000000006EX-2a3K Subject: [Openvpn-devel] [PATCH v1] win32: pass the buffer size in bytes to get_openvpn_reg_value() 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: 1880207992360797911 X-GMAIL-MSGID: 1880207992360797911 From: Heiko Hund get_openvpn_reg_value() expects the size of the value buffer in bytes, as documented and as RegGetValueW() expects it. All callers passed the number of characters instead, so only half of the buffer was used. Pass sizeof() of the buffers instead of _countof(). Change-Id: Ifa4497963989c2d6ba68d75942d368c112ac6f67 Signed-off-by: Heiko Hund Acked-by: Frank Lichtenheld Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2038 --- 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/+/2038 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c index fde6412..3af58ed 100644 --- a/src/openvpn/win32.c +++ b/src/openvpn/win32.c @@ -1491,7 +1491,7 @@ set_openssl_env_vars(void) { WCHAR install_path[MAX_PATH] = { 0 }; - if (!get_openvpn_reg_value(NULL, install_path, _countof(install_path))) + if (!get_openvpn_reg_value(NULL, install_path, sizeof(install_path))) { const WCHAR *ssl_fallback_dir = L"C:\\Windows\\System32"; /* if we cannot find installation path from the registry, @@ -1585,8 +1585,8 @@ /* Attempt to retrieve the trusted plugin directory path from the registry, * using installation path as a fallback */ - if (!get_openvpn_reg_value(L"plugin_dir", plugin_dir, _countof(plugin_dir)) - && !get_openvpn_reg_value(NULL, plugin_dir, _countof(plugin_dir))) + if (!get_openvpn_reg_value(L"plugin_dir", plugin_dir, sizeof(plugin_dir)) + && !get_openvpn_reg_value(NULL, plugin_dir, sizeof(plugin_dir))) { msg(M_WARN, "Installation path could not be determined."); }