From patchwork Sun Oct 18 15:37:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5488 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:848c:b0:8dc:5c83:a4ec with SMTP id z12csp495690max; Sun, 18 Oct 2026 08:37:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBwfuJ8V8JQKp47+TUa8jAo1vnjPqtP8AYbZzyfLrFRt67VlRO3uh0eHWb3YpE/2Q1onpmW1eafxXTM=@openvpn.net X-Received: by 2002:a05:6820:1a04:b0:6ef:7694:b58b with SMTP id 006d021491bc7-70357fa0835mr3397738eaf.81.1792337878397; Sun, 18 Oct 2026 08:37:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1792337878; cv=none; d=google.com; s=arc-20260327; b=GNeL7+D2aYfRe799083W2a6TtOFAPADVubgqhHuWjH69//nqmBboK2RsYEWnMgtXP5 T13ymf6AyYAmEdiL8XtxgWQkih9Ru+TbYQDcvB31tmZakWhF87DBYAlrm5Pdu1bGnaq1 7MDf3gfROlvERJkHTbzmYOqzZQXjXjpzunwLkKOdkILdyZLkeAot1BtZxu6s7vPLJSxs UJH7SH/SXs4356fNw03uAgiccOa4Y/5orqsOYxpR3bECkeQCy99KcjQ4cfOZVs4ihDJA yAJ1N/WYDI9yN1hn47eWi7dE+x+wL5Wa80LWGfvnRKLG+VPJDR07bCu9o17rN6/wU4Si ucKQ== 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=SQPA3Hre7hffGJScYqzYC8FbCcckefjFAwEAArBdhVg=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=rgiWVH/Lr0ioywV27nvdQLmYVAgvsSnquU5vPDnCWbHKPOFnVwEFoQysJBcHgEUscy qsOReDcHzfqwTKqYd35HoztMUsa8SjMD0vsKVqOZizz/dCym7Hd4htOBeuiGX7wkwNdd z/GemKeICVptbVgUvjifTTGsxREnYAew86+U0hSCGgVRBg0wZmMV3oTP5GwugEVAOxg5 yGGr9CUWSt5xeYkAEpTMmz6KXwne3npxNqhUSwdyEFlcQbiR0V06voxTRLX9nkyyFQ1p iU/EnXNed5B1kCsnmBlXBvd1s/vesjLgIrq5xC+yty/hDPPicrqK0tBBQT2usXj9T2+H K/fw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=Iy5yz6C0; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=DVqINUQI; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=EPowTZSI; 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-4a73b89c85esi10713554fac.343.2026.10.18.08.37.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Oct 2026 08:37:58 -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=Iy5yz6C0; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=DVqINUQI; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=EPowTZSI; 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=SQPA3Hre7hffGJScYqzYC8FbCcckefjFAwEAArBdhVg=; b=Iy5yz6C0J6FvTCv47xFU/c8brW Bp04R8QEX3XwVb7VdkIZ2ieS1uOU72Rhrv01NcpjZT0SycSxZS3tdnn20tmR6j16YKRVNn/fkJp6/ 27F+IbMljJuDvDsJO7gRSvk/kSS78+9WeKFi1DeZp9/JLOncipbSKkBEt+YTmmScRaL8=; Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1xISxH-0003oQ-3p; Sun, 18 Oct 2026 15:37:47 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1xISxG-0003oE-0V for openvpn-devel@lists.sourceforge.net; Sun, 18 Oct 2026 15:37:46 +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=ysSKWhLvqFYErGLBTQ/MaltiUM3sSCztGdtSkojlYdI=; b=DVqINUQIIvMusA3K9u4iCvvUF7 bMyCadK/2T5txfbj43raTrs8uf6grUn0MTTOZ5flU/pOSeX7MW8qHCeLZVIRH2CijsJyr+ZphHO/Q clJE45TQUZfBD38wLoOoLHEMN5V2a1cT7UXIs9wJtg3fAjLH8p+iVRdikbj3wzNJd1GQ=; 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=ysSKWhLvqFYErGLBTQ/MaltiUM3sSCztGdtSkojlYdI=; b=EPowTZSI/eMrsenUyUBmNNcmsW k9LA+ocgyhsk/6ZBAbHUAQLluiStk0/ORzjOzn6+IeqqZZ5u6Shzl1ILv9ndq0PUfm8DdwpWzrlLn SUPqbk//YVcp3m8uwxPEZskmYaoU/2ZXVXfTAdUegY14G0NGKraH//SOF0W9Cx4tn9dw=; 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 1xISxF-0001bq-R6 for openvpn-devel@lists.sourceforge.net; Sun, 18 Oct 2026 15:37:46 +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 69IFbc0a023289 for ; Sun, 18 Oct 2026 17:37:38 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 69IFbcwZ023288 for openvpn-devel@lists.sourceforge.net; Sun, 18 Oct 2026 17:37:38 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Sun, 18 Oct 2026 17:37:32 +0200 Message-ID: <20261018153738.23274-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 Make sure we have a sane length and convert it int. Change-Id: I0245175f2884d56838990f53cee6381b981b79c1 Signed-off-by: Frank Lichtenheld Acked-by: Razvan Cojocaru Acked-by: Gert Doering 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: 1879402483229312791 X-GMAIL-MSGID: 1879402483229312791 From: Frank Lichtenheld Make sure we have a sane length and convert it int. Change-Id: I0245175f2884d56838990f53cee6381b981b79c1 Signed-off-by: Frank Lichtenheld Acked-by: Razvan Cojocaru Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2004 --- 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/+/2004 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Razvan Cojocaru Gert Doering diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c index 0e4669a..b420aac 100644 --- a/src/openvpn/misc.c +++ b/src/openvpn/misc.c @@ -72,11 +72,6 @@ #endif } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - #ifdef ENABLE_MANAGEMENT /* Get username/password from the management interface */ static bool @@ -127,19 +122,23 @@ parse_auth_challenge(const char *auth_challenge, struct gc_arena *gc) { ASSERT(auth_challenge); + const size_t len = strlen(auth_challenge); + if (!buf_size_valid(len)) + { + return NULL; + } - struct auth_challenge_info *ac; - const int len = strlen(auth_challenge); - char *work = (char *)gc_malloc(len + 1, false, gc); - const char *cp; + const int work_len = (int)len + 1; + char *work = (char *)gc_malloc(work_len, false, gc); struct buffer b; buf_set_read(&b, (const uint8_t *)auth_challenge, len); + struct auth_challenge_info *ac; ALLOC_OBJ_CLEAR_GC(ac, struct auth_challenge_info, gc); /* parse prefix */ - if (!buf_parse(&b, ':', work, len)) + if (!buf_parse(&b, ':', work, work_len)) { return NULL; } @@ -149,11 +148,11 @@ } /* parse flags */ - if (!buf_parse(&b, ':', work, len)) + if (!buf_parse(&b, ':', work, work_len)) { return NULL; } - for (cp = work; *cp != '\0'; ++cp) + for (const char *cp = work; *cp != '\0'; ++cp) { const char c = *cp; if (c == 'E') @@ -167,14 +166,14 @@ } /* parse state ID */ - if (!buf_parse(&b, ':', work, len)) + if (!buf_parse(&b, ':', work, work_len)) { return NULL; } ac->state_id = string_alloc(work, gc); /* parse user name */ - if (!buf_parse(&b, ':', work, len)) + if (!buf_parse(&b, ':', work, work_len)) { return NULL; } @@ -189,10 +188,6 @@ #endif /* ifdef ENABLE_MANAGEMENT */ -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - /* * Get and store a username/password */