From patchwork Mon Mar 2 18:16: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: 4789 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:292f:b0:83c:d90d:321 with SMTP id f15csp1962484maw; Mon, 2 Mar 2026 10:16:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUAU1E4ZFIpZg9pb7W5yjMmoYoeWksYSh2WlZopL6WzLPWbaCM2mMbi+qgoXT+ABoEpLAkkENV+qnI=@openvpn.net X-Received: by 2002:a05:6820:4b06:b0:679:be1c:caf0 with SMTP id 006d021491bc7-679fae16475mr7582339eaf.26.1772475403679; Mon, 02 Mar 2026 10:16:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1772475403; cv=none; d=google.com; s=arc-20240605; b=Ygq85Hk/IZbV1Mmg7COwZbZfOlwbKmAxYP4Czz/RxYIhLoVp3SSFg1QZu55QOMZfZ3 2J6FXXlecbABBkaHUlHFMlmXPYR8gpGytPMKQjOLu3iL5r1MH7yvdaVMm2R1P0taTPtR ep+Df1cDtqvdy2Gcrc3PDzwOGdJHbKz7GlaDCkFpqIC7ierGrqh0TqOPM/io7kO1QN5F q6Vrl7D0BMoyEbZ1lxc5FkJv0l5W/kPkGMHKbyMmL1g0Miiiqvf87JixwSGFpzwpwXE3 EwvezD1USZM5LczHIh879dInCPyL0dMUbWVZCcGZ8hIhyDsi5EWJg4OIWr+e4TzPS5SX mgnQ== 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=AA/TSUpLxYtQq4mlnYZxV5qQh5JQ3CM8gN6gcdoawlE=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=S4A8VIjYApLwmJb/3JyoqhQ7/PtHgtxGj78g8nhsL0UXYeS/VUqBWL5pU4aq2gGcaY dv9IjFfVGnID8ulL7/iRYYuBn65tQr1nsxgsjdiyffEUyHl5Vr2H97deRulKsEqlH0es 4SqtqXwr57bBCieamryf84qlKemMN6OZvU5fdSjojtZdEO8+NmsKjwOXuUSGk74Fd6Fy EBb9KRnSyO7SPs7QogOQWNV+ezc8Dh2OOhLMvdXrdmDtl5p0CWyCxepXh11Sg+QXCnN0 WxpQFR7E2kDR8rH4IQQAL0O3u/eRwZyDboKFCmg8O9GYz4ojQHcBRdatzAcv0Uj4UW62 bfGg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=mHjj3WhN; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=Y8cfn3zn; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=HXcq93Tr; 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 006d021491bc7-679f2bdf88csi7505258eaf.13.2026.03.02.10.16.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Mar 2026 10:16:43 -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=mHjj3WhN; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=Y8cfn3zn; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=HXcq93Tr; 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=AA/TSUpLxYtQq4mlnYZxV5qQh5JQ3CM8gN6gcdoawlE=; b=mHjj3WhNm6tOiy3wUUntxjPdkg 3X86uClO/5fENlGxlUXAaYW17SVdKACupqyx00KgF2a5Mq9VCs+io/9aKmzccoj2I6w48A0m/crcN C7UXRbXjgVhjpi9BSrKk573g6A07t2CDBKJWKWac/dO2wksAQ2F4gdHTtTFlMISSLMDI=; 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.95) (envelope-from ) id 1vx7or-00052t-Om; Mon, 02 Mar 2026 18:16:37 +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.95) (envelope-from ) id 1vx7op-00052l-M8 for openvpn-devel@lists.sourceforge.net; Mon, 02 Mar 2026 18:16:35 +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=QZid8UDmU2ffxp+712NBKk/LFHmQWIuFBC8TpEOGTM4=; b=Y8cfn3znooVjhy80ul2c86oVHn 0Q1runIDa65sFyNfUp3TU1+gArLmeQntAD5NNE4JgQbw8EtpkmpVs65fqlAYzVOG/js5onnoM6fTu yaGp3Tyam78jXEgWYPZso27vKXa5ZMcM9jRWvQeaiCfH6NDeF9XcG14yHbBxuqfGdALU=; 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=QZid8UDmU2ffxp+712NBKk/LFHmQWIuFBC8TpEOGTM4=; b=HXcq93TrS7589KHmRFO1wrRfzT pBDAJxBpYNqP+hXHPMZCXL2BNQic7ycxPeekr3jewUdD89hPnQjJkKOt6J5EnP6Whn1b928vDlrEM s1Nn6ETSF51XpxDSp0PEpw4/jBpcER5ofSgi1rgcJs2ke5OiCROk53WtW71mtDCyEHg8=; 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.95) id 1vx7oo-0005Yk-J8 for openvpn-devel@lists.sourceforge.net; Mon, 02 Mar 2026 18:16:35 +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 622IGRgr029024 for ; Mon, 2 Mar 2026 19:16:27 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 622IGRSl029023 for openvpn-devel@lists.sourceforge.net; Mon, 2 Mar 2026 19:16:27 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Mon, 2 Mar 2026 19:16:22 +0100 Message-ID: <20260302181627.29008-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.52.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 * Make it more readable by removing a level of negation * Fix an off-by-one error. It accepted one char fewer than allowed. * Slightly improve the UT. Change-Id: Ib0d2b9520e4a77a9f4bf70ce092f76ca73608537 Signed-off-by: Frank Lichtenheld Acked-by: Arne Schwabe Gerrit URL: https://gerrit.openvpn.net/c [...] 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: 1vx7oo-0005Yk-J8 Subject: [Openvpn-devel] [PATCH v5] ssl_ncp: Fix length check in mutate_ncp_cipher_list 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?1858575168690125432?= X-GMAIL-MSGID: =?utf-8?q?1858575168690125432?= From: Frank Lichtenheld * Make it more readable by removing a level of negation * Fix an off-by-one error. It accepted one char fewer than allowed. * Slightly improve the UT. Change-Id: Ib0d2b9520e4a77a9f4bf70ce092f76ca73608537 Signed-off-by: Frank Lichtenheld Acked-by: Arne Schwabe Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1503 --- 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/+/1503 This mail reflects revision 5 of this Change. Acked-by according to Gerrit (reflected above): Arne Schwabe diff --git a/src/openvpn/ssl_ncp.c b/src/openvpn/ssl_ncp.c index 500e09d..fdac6925 100644 --- a/src/openvpn/ssl_ncp.c +++ b/src/openvpn/ssl_ncp.c @@ -92,11 +92,6 @@ } } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-compare" -#endif - char * mutate_ncp_cipher_list(const char *list, struct gc_arena *gc) { @@ -168,7 +163,7 @@ } /* Ensure buffer has capacity for cipher name + : + \0 */ - if (!(buf_forward_capacity(&new_list) > strlen(ovpn_cipher_name) + 2)) + if (buf_forward_capacity(&new_list) < (int)strlen(ovpn_cipher_name) + 2) { msg(M_WARN, "Length of --data-ciphers is over the " "limit of 127 chars"); @@ -207,10 +202,6 @@ o->ncp_ciphers = ncp_ciphers; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - bool tls_item_in_cipher_list(const char *item, const char *list) { diff --git a/tests/unit_tests/openvpn/test_ncp.c b/tests/unit_tests/openvpn/test_ncp.c index 9f569a7..52a41ee 100644 --- a/tests/unit_tests/openvpn/test_ncp.c +++ b/tests/unit_tests/openvpn/test_ncp.c @@ -123,10 +123,23 @@ assert_ptr_equal(mutate_ncp_cipher_list("AES-256-GCM:vollbit", &gc), NULL); assert_ptr_equal(mutate_ncp_cipher_list("", &gc), NULL); - assert_ptr_equal(mutate_ncp_cipher_list("ChaCha20-Poly1305:ChaCha20-Poly1305:ChaCha20-Poly1305:" - "ChaCha20-Poly1305:ChaCha20-Poly1305:ChaCha20-Poly1305:" - "ChaCha20-Poly1305", - &gc), + const char long_string[MAX_NCP_CIPHERS_LENGTH] = + "CHACHA20-POLY1305:CHACHA20-POLY1305:CHACHA20-POLY1305:" + "CHACHA20-POLY1305:CHACHA20-POLY1305:CHACHA20-POLY1305:" + "CHACHA20-POLY1305"; + const char longer_string[MAX_NCP_CIPHERS_LENGTH + 1] = + "CHACHA20-POLY1305:CHACHA20-POLY1305:CHACHA20-POLY1305:" + "CHACHA20-POLY1305:CHACHA20-POLY1305:CHACHA20-POLY1305:" + "CHACHA20-POLY1305:"; + const char longest_string[] = + "CHACHA20-POLY1305:CHACHA20-POLY1305:CHACHA20-POLY1305:" + "CHACHA20-POLY1305:CHACHA20-POLY1305:CHACHA20-POLY1305:" + "CHACHA20-POLY1305:CHACHA20-POLY1305"; + assert_string_equal(mutate_ncp_cipher_list(long_string, &gc), + long_string); + assert_string_equal(mutate_ncp_cipher_list(longer_string, &gc), + long_string); + assert_ptr_equal(mutate_ncp_cipher_list(longest_string, &gc), NULL); #ifdef ENABLE_CRYPTO_OPENSSL