From patchwork Thu Nov 26 19:21: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: 5804 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:91c9:10b0:11b:d6c:f273 with SMTP id tl9-n1csp7651422lad; Thu, 26 Nov 2026 11:21:41 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErF2b5aguWR3PXwGrpxF+QxWhlBAedVz3beBjYJlo3a5ew0qaHeOnQ0COzg+yQN5TMN92cQMqUp5tto=@openvpn.net X-Received: by 2002:a05:7301:700a:b0:384:988d:6ec2 with SMTP id 5a478bee46e88-3856f6524acmr23804431eec.33.1795720901358; Thu, 26 Nov 2026 11:21:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795720901; cv=none; d=google.com; s=arc-20260327; b=matFeaAA5nnsZpc0EPIoOg/rZISXEoanai27hV3hIgL8t/VrW1sUeSx2p++X/+MhM4 i0QyeCcs9svpeZJIrJhg1SuxPHJJYkJKxQdHF3uKuPHyD/+oHlZMknPIR8uvVzBpYxej gXxOnuY7EVC37IrzjALR+Ye3ph51ZWAH0GcsWAVV5suKL+u7c3D9d9llC0469DJJg1Sr 7No9BIjWW9vg4+egipm/cyv8ROLR4AwwWcX8hz4h1YKaWPeNyH3hZFCC9ULOduQj+7Om U4I+G5Gl0hx0eP85HWS4YWSxb9Cxn7aeIU+/TEbVqZUCyXqWWL5bgQrbFhvSOthOmvMI VNpg== 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=sjHZXaOsIF4Nh+9ruaLG6sXtK/ehvPTvUnbRDoMu2cU=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=ray6qBssu4r3CETx1ukavE6TmXVFCWN3GToEuegnrC9R0G1xYhoIT1z1CYuHjw4mx9 T7pFRvD5JWb5eFokg7prlIOdJqnEJqsCQEl7gCxqiQN1UaHfLIyaHx6HmUPf+4Bpg/Gs KLkFxl8Xf6iekXOvGDcNI83DnOGEKZN4m1612/mfL1vqAmki4gjQGjjJMApHxE/Pk4SY kkjTfgF/1oi0G6PZ2VAbYDkJPrSxkQCilqkjsFz/CEKfmJLQG4ECRhy+658WfJ340X9q bfEeWlcPaQ4Vp3x3PCPwJzzWxKfZceRD5aVVpsNkxLjiCuXbnSBRrKfnwHyqfo1P5Hho TDAg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=XzVSKNJG; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=Ung15+jG; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="V0TDt/6A"; 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-38567cad3d7si56646893eec.46.2026.11.26.11.21.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Nov 2026 11:21:41 -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=XzVSKNJG; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=Ung15+jG; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="V0TDt/6A"; 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=sjHZXaOsIF4Nh+9ruaLG6sXtK/ehvPTvUnbRDoMu2cU=; b=XzVSKNJG5bRyd+ RVrbrAp+beMI7u0GP9bOxx2JpDIuS3qgVx47b1m62AXSxB0xzZsX6K/1LLc2d4ocMPFJIJ9eeUjub UyVIxUSCLrKbRjXj29tm5E6rAUF33Ft5Q09E7RHAMQqZaMBf9PTOrrL/uPrhpDSPVuu0VVtwbE/3V nSU=; Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.100.1) (envelope-from ) id 1xWf2I-000000002xr-11Vf; Thu, 26 Nov 2026 19:21:38 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xWf2G-000000002xk-3JPP for openvpn-devel@lists.sourceforge.net; Thu, 26 Nov 2026 19:21:36 +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=D28bNwFRxlFV2bOyJlWxOWBI010dSsuJ/H+RLpwKCvI=; b=Ung15+jGWOddqY/9V8bNELkZPK ChhKaAocPoqEpjBECs6HbheHor/VVK047HhaAnSzzGz1SleKbQF2R79EB3gAnT/gDHOaX9B57cZJ2 h61WdK+avQsoNQ9enIcpTDxPXfWXw0qIrZh/RrpOSge7d4rtfUmG48/xZLzJjpuk/tW8=; 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=D28bNwFRxlFV2bOyJlWxOWBI010dSsuJ/H+RLpwKCvI=; b=V0TDt/6Aqz8/H/ISxlywPOOd9P M2zUsZwuJ84uxlqLrUUlHo46tSJAzgcjSGE3E4PWXXgplsOBhA/XLD1vg8QzEMd7a7CaZ2ZLISIw0 mx7XnVnNVOD4FgLE0C2b3zBcv04WdhMqlJpnKr65A+pEaQ0nIsACWWrLmRefJZeFyk9U=; 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 1xWf2F-0000000089u-0WGL for openvpn-devel@lists.sourceforge.net; Thu, 26 Nov 2026 19:21:36 +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 6AQJLSCn018891 for ; Thu, 26 Nov 2026 20:21:28 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 6AQJLSHn018890 for openvpn-devel@lists.sourceforge.net; Thu, 26 Nov 2026 20:21:28 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Thu, 26 Nov 2026 20:21:22 +0100 Message-ID: <20261126192127.18879-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: Frank Lichtenheld MultiByteToWideChar and similar functions take int and return int. Nothing we can do about that except cast. Change-Id: I32f1edf8b289ea2f7fda35e32260909c6409344e Signed-off-by: Frank Lichtenheld Acked-by: Razvan Cojocaru Gerrit URL: https://gerrit.openvpn.net/c/o [...] 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: 1xWf2F-0000000089u-0WGL Subject: [Openvpn-devel] [PATCH v1] openvpnserv: Avoid sign conversion warnings related to string conversion 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: 1882949839642709390 X-GMAIL-MSGID: 1882949839642709390 From: Frank Lichtenheld MultiByteToWideChar and similar functions take int and return int. Nothing we can do about that except cast. Change-Id: I32f1edf8b289ea2f7fda35e32260909c6409344e Signed-off-by: Frank Lichtenheld Acked-by: Razvan Cojocaru Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2357 --- 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/+/2357 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Razvan Cojocaru diff --git a/src/openvpnserv/common.c b/src/openvpnserv/common.c index de7847e..6c1250b 100644 --- a/src/openvpnserv/common.c +++ b/src/openvpnserv/common.c @@ -30,11 +30,6 @@ LPCWSTR service_instance = L""; static wchar_t win_sys_path[MAX_PATH]; -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-conversion" -#endif - static DWORD GetRegString(HKEY key, LPCWSTR value, LPWSTR data, DWORD size, LPCWSTR default_value) { @@ -300,11 +295,11 @@ utf8to16_size(const char *utf8, int size) { int n = MultiByteToWideChar(CP_UTF8, 0, utf8, size, NULL, 0); - if (n == 0) + if (n <= 0) { return NULL; } - wchar_t *utf16 = malloc(n * sizeof(wchar_t)); + wchar_t *utf16 = malloc((size_t)n * sizeof(wchar_t)); if (!utf16) { return NULL; @@ -313,10 +308,6 @@ return utf16; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - const wchar_t * get_win_sys_path(void) { diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 0792a51..e99f8b5 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -2760,7 +2760,7 @@ size_t domains_len = strlen(domains); dom_size = (DWORD)domains_len + 2; /* len + the trailing NULs */ - wide_domains = utf8to16_size(domains, dom_size); + wide_domains = utf8to16_size(domains, (int)dom_size); if (!wide_domains) { return ERROR_OUTOFMEMORY; @@ -3917,9 +3917,9 @@ CloseHandleEx(&stdin_read); CloseHandleEx(&svc_pipe); - DWORD input_size = WideCharToMultiByte(CP_UTF8, 0, sud.std_input, -1, NULL, 0, NULL, NULL); + int input_size = WideCharToMultiByte(CP_UTF8, 0, sud.std_input, -1, NULL, 0, NULL, NULL); LPSTR input = NULL; - if (input_size && (input = malloc(input_size))) + if (input_size > 0 && (input = malloc((size_t)input_size))) { DWORD written; WideCharToMultiByte(CP_UTF8, 0, sud.std_input, -1, input, input_size, NULL, NULL);