From patchwork Thu Nov 26 18:44:37 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5803 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:91c9:10b0:11b:d6c:f273 with SMTP id tl9-n1csp7610519lad; Thu, 26 Nov 2026 10:45:21 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErGsITZc9iy2pc5ijwMgsOyFxf9Q6ecNznpOLhB61zKD3Da0lAUI1ooi3HqniY46UpYqtQA3hzbwtH8=@openvpn.net X-Received: by 2002:a05:7301:7107:b0:386:b494:8642 with SMTP id 5a478bee46e88-386b494879amr12226927eec.13.1795718721483; Thu, 26 Nov 2026 10:45:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795718721; cv=none; d=google.com; s=arc-20260327; b=qCR4sMr8wl+9ydRB30yJeiDM6CPEqyy6Shb9Fk1dg9x0yIZSd4LsGguPgEnYXuDvKL QiN9DadDb7c9NtaQpzlO05137evtmz8lqU11Mr0Edcwjc3lp/3ddiMoG+yz+RaeOeQeX YZWDZTmHHCKetRp0Y/p4jLcWGvGKRS6jLB2ZUHmvsv56CfNq6ZN5HM3G9DkmyVeLq183 1whqBoTIr4ev478mp6wNDgILXtpMK+kGacN1wpf5lPB2Crhu/rdeFVfIK2tTvViPi5qT MmZPK+73ot6vpU9ygBOVcj5Zy5JpEBH2ZZJNGgGtxwR9ZLMDXyg7N/aWPYCIapG8lemA /VEw== 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=az8Mlj/zwMwqPF6p/2hkQF6NO053moa7xFT97Eb6JbE=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=j8lEIQHVL4xs17i9yxIwYEn+AinSPIwRc1+VPuLQEa1SjFUcv77CoWyxW8nXriyMIF ay02tWgIjE+eNcTFvZosHWOG0bHciaDK8XkCDLfjsCRV7AiNF6lpiVXCM67cMkE6DcC1 2fT51eP0cDKmgMWt9v34v1JdONsiseU1+D1FHqrP1sh45tug97V5Vdk+RU05+2N5jxkH C95J5p3px3slHvXO1y8u8IK0PngCLEVQLYpqRTtB+L4dVp5+2IPRguS1TvW26QLCLtIF rRwR2VPI4s8oc3hV8PGodrrjr5whpJiu3aZeUunpZY9vey6TfvgZjeVymVBLaSwiNVwo GUMw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=OxYduf+i; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=ivb8ZQCd; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=mMVlArgH; 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 5a478bee46e88-385677bf479si53302347eec.39.2026.11.26.10.45.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Nov 2026 10:45:21 -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=OxYduf+i; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=ivb8ZQCd; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=mMVlArgH; 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=az8Mlj/zwMwqPF6p/2hkQF6NO053moa7xFT97Eb6JbE=; b=OxYduf+i6SoAge 9A54dbiOUFbAI6bJxN5sKl8f5guN/9sBAYIIO4rStl7WAxI557uWSQURBGgbkrNGEcYfGM47NyaXc 8TUGIwtbNCrDHlk0tjauUmqg8PAwUiZaKZ1+PEPScSFQJd0cC77yh1NbIu2j+thFsaAOB8wg8I1li KSc=; 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 1xWeSj-0000000083T-1cU1; Thu, 26 Nov 2026 18:44:53 +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 1xWeSh-0000000083M-3HTh for openvpn-devel@lists.sourceforge.net; Thu, 26 Nov 2026 18:44:51 +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=9UgKH/I5zIDDAooeRhk4LQp7IzTOCCK04uZwNGY0ITA=; b=ivb8ZQCd+hS1lVnRy7Ct4qi9OZ 3NeuLK3B7eqXiAuAIWMOzzwlDj7TBcaUIdOQaJu9lOyd0VV9fOagCZitFcsaitmt8RNiUbDKvZMal pMxDvS1TCuYqfyMWhBGdmqRMPzhkzQLN/3TWfJxoR4hiygFusdaQPiafTO2MuyV+Ysec=; 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=9UgKH/I5zIDDAooeRhk4LQp7IzTOCCK04uZwNGY0ITA=; b=mMVlArgHTfktnZPxEuwmp5u7bU XzZZ3KfRptXPPFaOK8ArUARuMyJ/QT05y0u+LJb/ggplhwRGVQJ4sfo7zGRougjMsERIWOvAcD7Uv 9PEwQDpx1Cpzs8HdaGk44CchDkILosz4Gy5Ctf5Dx6s3KshoJo8lEGpdmiHbeeE79jz8=; 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 1xWeSg-000000007JS-1wn0 for openvpn-devel@lists.sourceforge.net; Thu, 26 Nov 2026 18:44:51 +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 6AQIihnN015567 for ; Thu, 26 Nov 2026 19:44:43 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 6AQIihaJ015566 for openvpn-devel@lists.sourceforge.net; Thu, 26 Nov 2026 19:44:43 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Thu, 26 Nov 2026 19:44:37 +0100 Message-ID: <20261126184443.15556-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: Frank Lichtenheld Improve code in x_msg_va to handle vsnprintf result. Removes explict null termination that is not required in supported versions of Windows. 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: 1xWeSg-000000007JS-1wn0 Subject: [Openvpn-devel] [PATCH v1] openvpnmsica: Clean up sign conversion warnings 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: 1882947553869333261 X-GMAIL-MSGID: 1882947553869333261 From: Frank Lichtenheld Improve code in x_msg_va to handle vsnprintf result. Removes explict null termination that is not required in supported versions of Windows. Includes one unrelated cast that is too small to warrant its own commit. Change-Id: Ia5c265bd1f2723be93fb8fbb73e73a4e86d1cac7 Signed-off-by: Frank Lichtenheld Acked-by: Razvan Cojocaru Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2358 --- 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/+/2358 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Razvan Cojocaru diff --git a/src/openvpnmsica/dllmain.c b/src/openvpnmsica/dllmain.c index 777c823..e191207 100644 --- a/src/openvpnmsica/dllmain.c +++ b/src/openvpnmsica/dllmain.c @@ -98,11 +98,6 @@ return true; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-conversion" -#endif - void x_msg_va(const unsigned int flags, const char *format, va_list arglist) { @@ -124,26 +119,29 @@ /* Field 2: The message string. */ char szBufStack[128]; int iResultLen = vsnprintf(szBufStack, _countof(szBufStack), format, arglist); - if (iResultLen > 0 && (unsigned int)iResultLen < _countof(szBufStack)) + if (iResultLen > 0) { - /* Use from stack. */ - MsiRecordSetStringA(hRecordProg, 2, szBufStack); - } - else - { - /* Allocate on heap and retry. */ - char *szMessage = (char *)malloc(++iResultLen * sizeof(char)); - if (szMessage != NULL) + const size_t alloc_size = (size_t)iResultLen + 1; + if (alloc_size <= _countof(szBufStack)) { - vsnprintf(szMessage, iResultLen, format, arglist); - MsiRecordSetStringA(hRecordProg, 2, szMessage); - free(szMessage); + /* Use from stack. */ + MsiRecordSetStringA(hRecordProg, 2, szBufStack); } else { - /* Use stack variant anyway, but make sure it's zero-terminated. */ - szBufStack[_countof(szBufStack) - 1] = 0; - MsiRecordSetStringA(hRecordProg, 2, szBufStack); + /* Allocate on heap and retry. */ + char *szMessage = malloc(alloc_size); + if (szMessage != NULL) + { + vsnprintf(szMessage, alloc_size, format, arglist); + MsiRecordSetStringA(hRecordProg, 2, szMessage); + free(szMessage); + } + else + { + /* Use truncated stack variant anyway */ + MsiRecordSetStringA(hRecordProg, 2, szBufStack); + } } } } @@ -159,7 +157,7 @@ MsiRecordSetInteger(hRecordProg, 1, ERROR_MSICA_ERRNO); /* Field 3: The Windows error number. */ - MsiRecordSetInteger(hRecordProg, 3, dwResult); + MsiRecordSetInteger(hRecordProg, 3, (int)dwResult); /* Field 4: The Windows error description. */ LPWSTR szErrMessage = NULL; @@ -194,7 +192,3 @@ hRecordProg); MsiCloseHandle(hRecordProg); } - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif