From patchwork Sat Nov 22 15:55:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4619 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:6c3:b0:7b1:439f:bdf with SMTP id j3csp901518maw; Sat, 22 Nov 2025 07:55:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWA5zvTDOdUrfq3CgWmCC5PU1Ob9xvfpLQb3HKlihNMFZONPYWYP3q/8UXbyWzyqniSCOfMenNTRNA=@openvpn.net X-Google-Smtp-Source: AGHT+IHMmJT7/mG1RvHbXre2wgTZaVkmBwG3mwJuTavlgpHRZCehfMUGTjwGBOCWGpmMj3VNlLj9 X-Received: by 2002:a05:6870:4410:b0:3e8:98d7:72e5 with SMTP id 586e51a60fabf-3ecbe630ecdmr2271852fac.46.1763826924689; Sat, 22 Nov 2025 07:55:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1763826924; cv=none; d=google.com; s=arc-20240605; b=AA6pKSrIgyMfLOtjYbt3GwRGQSmTD0kPXLBC5QD8b6TXm2lKjllCOvHL0CUGJN/0Rq E13RDJ3bhcNqkSBN7vQwglz/N4LuQT0XaoAiHkmPekd8uZiDLblQ7JcwW8MAsG53r4Q2 AXY9Zm85R8gX9ZD3OKu1sDZzUor1i+5dH7Rmj1IKZVU6TWS5smpkCEEjC8UaXo9h8RN9 lTMbcUIvVr8aUCaGgOQVug0e98VFkpaigcxSM1e05TJ9WlOYiBjT+Iu9y4osAu804AHV yNSF1VuIFswJQpBzYSByWidIT0rqV9mMDX4WT2uIfi3rT2z3y3SDTJRCYTP9iuEr6Rzl U99A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=RnhAyac4j7KkilEHOvBXoO+t1obVbWUxNrT7Br3cv4o=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=LXo/GouVBRQ1etkQJR/ZYrJGe2qqcd308kcJ3OAuVtHEs03O1/yxB1DL5ao6jbytkR bNjstwlGpYgkMPJRBCcFDePMIN/oGi8LjN7icn1hjdR8GHlshi1xgs1Jz9CthRkyYLsZ ed4TI0PGqFvuoWzxGWT5VxAkyBkPQ7qnTJxJcOesQ7givqSplljPbSd/yKbZf0c81eVJ 5WNtGJGjzO4VjNGYi4hUSRLYJN5zRKuna8sJ/WpFuJ7GCNBiRzrdJBLtO52EIxjAuu0z r1nw+x1orMAe7qsxUsn9x26mEiD5VNct0+50pdk6uKXCiJzjWlASw4Dt+kBNZ7wyO3FG w0qA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=JaGVqd+6; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=VnvCteWV; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=K3VvsiAH; 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-3eca1ad3f28si1587900fac.497.2025.11.22.07.55.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Nov 2025 07:55:24 -0800 (PST) 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=JaGVqd+6; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=VnvCteWV; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=K3VvsiAH; 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-Owner; bh=RnhAyac4j7KkilEHOvBXoO+t1obVbWUxNrT7Br3cv4o=; b=JaGVqd+6XXnYB+r7TTOdt6JBri emsd/uHsVDuZMt8gDjNtEJsF0KQtbOcKuM00UDgC2t4UVCFhjd3eZWexS1UnN3TRfLRTTYpSVeoHk PJKalNAfPAHz9I+4wC3EyFXtqwpKiUaKDpSpI80awAT5A/qRsju8a5QcJZ3w9DMOivfs=; 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.95) (envelope-from ) id 1vMpxK-0006rm-Bs; Sat, 22 Nov 2025 15:55:22 +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.95) (envelope-from ) id 1vMpxI-0006qx-Py for openvpn-devel@lists.sourceforge.net; Sat, 22 Nov 2025 15:55:20 +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-Subscribe:List-Post:List-Owner:List-Archive; bh=fOkvz4gDgGHmKIjnnmorq3RgPejpcQyW6PtISWEJj+w=; b=VnvCteWVDigm4wM4d6yXE74IuG iNGZ0vDOlD2tl4G/KNnns9Nb6o7FKyGW2qwF3TvhBS1bnDQXkYh6XRFY4aylp8v+rghlJmvRLeHOe 4BjVaw4LgGh51dbtz4LiuP2y60nQ83eyOSgdZBNFNvQ0eWg4w8XOhW8CH//+DKMKiOXo=; 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-Subscribe: List-Post:List-Owner:List-Archive; bh=fOkvz4gDgGHmKIjnnmorq3RgPejpcQyW6PtISWEJj+w=; b=K3VvsiAHmkRj4pC2myffzG2byQ NMq2pL6LJo248quG8m164PSXGEw4NjYfx8RLvAj2vEoFdNEmSTOS6zEcWseDBJkF1U+bvVKK788Gz dI1EHCQkBiE1uU9wddIdrd0wAkI3JvtyDcb0Q2Kfy5bM3UbWFjesr1/GZxOWG3q3XlF4=; Received: from [193.149.48.134] (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.95) id 1vMpxH-0001nc-BQ for openvpn-devel@lists.sourceforge.net; Sat, 22 Nov 2025 15:55:20 +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 5AMFt6Mj008919 for ; Sat, 22 Nov 2025 16:55:06 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 5AMFt6Lf008918 for openvpn-devel@lists.sourceforge.net; Sat, 22 Nov 2025 16:55:06 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Sat, 22 Nov 2025 16:55:00 +0100 Message-ID: <20251122155506.8901-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.49.1 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 The buffer size is to be given in # of TCHARs according to the docs. In this case that is the number of WCHARs in the buffer. While here, remove the unused FORMAT_MESSAGE_ARGUMENT_ARRAY flag. Just to make things a bit shorter. 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: 1vMpxH-0001nc-BQ Subject: [Openvpn-devel] [PATCH v2] iservice: fix buffer size in call to FormatMessage 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: =?utf-8?q?1849506581517155990?= X-GMAIL-MSGID: =?utf-8?q?1849506581517155990?= From: Heiko Hund The buffer size is to be given in # of TCHARs according to the docs. In this case that is the number of WCHARs in the buffer. While here, remove the unused FORMAT_MESSAGE_ARGUMENT_ARRAY flag. Just to make things a bit shorter. Reported-by: stephan@srlabs.de Change-Id: I4c3e5aed23d2e4c543066bb8032ad8808dcd27a8 Signed-off-by: Heiko Hund Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1387 --- 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/+/1387 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 33282c63..f64c247 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -734,9 +734,8 @@ err_str = L"Unknown Win32 Error"; - if (FormatMessage(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM - | FORMAT_MESSAGE_ARGUMENT_ARRAY, - NULL, err, 0, buf, sizeof(buf), NULL)) + if (FormatMessageW(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, err, 0, buf, _countof(buf), NULL)) { err_str = buf; }