Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 20601C43458 for ; Fri, 26 Jun 2026 19:01:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Type:Cc:Reply-To:From: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:Message-ID:References:To:Date:Sender: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: List-Owner; bh=VZObyxOwAei5K3qw7N01AfDyc3uZPjPqGORlmEhZuGE=; b=Md0/z5P3ilWmh/ C+LfUT1m0Q+1ZHQvgolNy2T7vMqBHXvxS7BsSg87ObETHLMmmR0FxErwfUA2p73PycjVTWCgqxno7 iK9tBdL3jYr/4kpdtlFSn/cSB8aMfu/p1lruFe6p0ec2ymzecmwf8ecw5jNe3AtyJTinbKBJ+j0aT MkY=; 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 1wdBnR-0004H7-P4; Fri, 26 Jun 2026 19:00:59 +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 1wdBn8-0004Cf-7U for openvpn-devel@lists.sourceforge.net; Fri, 26 Jun 2026 19:00:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version :Message-ID:Reply-To:Subject:References:List-Unsubscribe:List-Id:Cc:To:Date: From:Sender:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help: List-Subscribe:List-Post:List-Owner:List-Archive; bh=rKj0CoG8RRbTIZV05rGVK6uuSh9/Hb+/v+L/D1ojFZY=; b=R0a3QNopUz+7Y6jri8W3aE0HJc T7HbLLGURzJ9oM9j4+59YGhB+8jrjrFNOZD1Ug3O9qTMC5RF6OMV5jHxVfJa6ExSCyygUtGFHVQC2 wPaCMWs7HsRvZUEMyNjxf/jVnh0MRhN+cT39kVWjWh2u+8MuzbmJZ4eLIUuHIObFbrug=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Reply-To: Subject:References:List-Unsubscribe:List-Id:Cc:To:Date:From:Sender:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help:List-Subscribe:List-Post: List-Owner:List-Archive; bh=rKj0CoG8RRbTIZV05rGVK6uuSh9/Hb+/v+L/D1ojFZY=; b=W HolW9Up7eyTp3Wo04miwoLXJtOKSPGQQWkWev4wlvzvDB+8p/stndQlLewcZLhEFyeK9LwgbuQ3tm 0MDCXdB6uxj5/sbOzomyifALgCDLKJyvlhSj3a1R305ynnbYmxPsVFfy16uvWr409wfC/v7PGxRbx OzoGAZMzgXL8FGUo=; Received: from mail-wm1-f53.google.com ([209.85.128.53]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1wdBmt-0000oS-Nm for openvpn-devel@lists.sourceforge.net; Fri, 26 Jun 2026 19:00:31 +0000 Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4923fb1f095so12857675e9.1 for ; Fri, 26 Jun 2026 12:00:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1782500417; x=1783105217; darn=lists.sourceforge.net; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:subject:thread-index:references :list-unsubscribe:list-id:auto-submitted:cc:to:date:from:from:to:cc :subject:date:message-id:reply-to; bh=rKj0CoG8RRbTIZV05rGVK6uuSh9/Hb+/v+L/D1ojFZY=; b=B8XwJuFsVl98Kl6gAjY2w6lAJ5HnLgXTH4I/PW2tfcy/L3EMyGDPEk7eVUrd6BMp1x OiTQUFESUEERHUqtCx2ynPLYWR6MKxm9IclAY7eZTg6y5if1K0gQdPGUojzBnRFlLFNE 6m/sfzZ3aadbWKlfDu852eumtFbNGfHl//rLhi+GFxJ5+znFFrNpSas68aNzNkSDn8tP Z8tXVjd60ffCandj5L/Gwm1esqD6+rWZkl9UWoxtyyYElZSpkbWtZwLFDFrO8CYZhQDa +vJQi6a6kI3wwGXFzdnmEy8ChPGogrBGp4qFwJ9xnXntRqR47cZzzp2DsxSjMzPWKY8k qAow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782500417; x=1783105217; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:subject:thread-index:references :list-unsubscribe:list-id:auto-submitted:cc:to:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rKj0CoG8RRbTIZV05rGVK6uuSh9/Hb+/v+L/D1ojFZY=; b=RUhZGA8eU0d1BjcwL0fUTUgmxx4lE0v49j8RKMqOXxvWHCs4v7hk3u6H3AEBje3cgY vS0fJdpUW/4hZ3AF6oIuXIE4xSJOCMAoTDia9cSYLpkPM/DS7F/n43k61bqQVZ+p1oE8 Tmauhn0GBJ2J/U7MBLx6f9N1k3rn21avcvMr2/hMsobwt+u3DD56cSvB3pd68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fri, 26 Jun 2026 12:00:16 -0700 (PDT) Received: from ip-10-18-1-162.eu-central-1.compute.internal (ec2-18-159-0-78.eu-central-1.compute.amazonaws.com. [18.159.0.78]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4926f94f213sm40192175e9.12.2026.06.26.12.00.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2026 12:00:15 -0700 (PDT) X-Google-Original-From: "d12fk (Code Review)" Date: Fri, 26 Jun 2026 19:00:15 +0000 To: plaisthos Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange X-Gerrit-PatchSet: 1 X-Gerrit-Change-Id: I6595695ab6401047d498d530f8739686880bea3a X-Gerrit-Change-Number: 1733 X-Gerrit-Project: openvpn X-Gerrit-ChangeURL: X-Gerrit-Commit: 598ef6d9a287492e03ddfa9f6507d99443fa6265 References: Thread-Index: PGdlcnJpdC4xNzgyNTAwNDExMDAwLkk2NTk1Njk1YWI2NDAxMDQ3ZDQ5OGQ1MzBmODczOTY4Njg4MGJlYTNhQGdlcnJpdC5vcGVudnBuLm5ldD4= Message-ID: <7746a00578e39cfeaec1c01bf4a3eb102bab2c97-HTML@gerrit.openvpn.net> MIME-Version: 1.0 User-Agent: Gerrit/3.11.5 X-Headers-End: 1wdBmt-0000oS-Nm Subject: [Openvpn-devel] [S] Change in openvpn[master]: mingw: avoid C99 "hh" scanf length modifier 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: , From: "d12fk \(Code Review\) via Openvpn-devel" Reply-To: heiko@openvpn.net, arne-openvpn@rfc2549.org, openvpn-devel@lists.sourceforge.net Cc: "d12fk \(Code Review\)" , openvpn-devel Content-Type: multipart/mixed; boundary="===============1963762364173111471==" Errors-To: openvpn-devel-bounces@lists.sourceforge.net --===============1963762364173111471== Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="Nsi0inbli6I="; charset=UTF-8 --Nsi0inbli6I= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos=2E Hello plaisthos, I'd l= ike you to do a code review=2E Please visit http://gerrit=2Eopenvpn=2E= net/c/openvpn/+/1733?usp=3Demail to review the following change=2E Chang= e subject: mingw: avoid C99 "hh" scanf length modifier =2E=2E=2E=2E=2E=2E= =2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E= =2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E= =2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E=2E mingw: avoid C99 "hh" scanf len= gth modifier read_key_file() and parse_hexstring() parse hex bytes with ss= canf() using the C99 "hh" length modifier, storing directly into an octet= =2E This is not portable to the legacy MSVCRT runtime that Ubuntu resolute= 's (26=2E04) mingw toolchain links against=2E Scan into an unsigned int an= d cast to the octet instead=2E The field width caps the value at 0xFF, so t= he narrowing cast cannot lose data=2E Change-Id: I6595695ab6401047d498d530= f8739686880bea3a Signed-off-by: Heiko Hund -= -- M src/openvpn/crypto=2Ec M src/openvpn/cryptoapi=2Ec 2 files changed, 6 = insertions(+), 4 deletions(-) git pull ssh://gerrit=2Eopenvpn=2Enet:29= 418/openvpn refs/changes/33/1733/1 diff --git a/src/openvpn/crypto=2Ec b/s= rc/openvpn/crypto=2Ec index 7954e8a=2E=2Edb84a33 100644 --- a/src/openvpn/c= rypto=2Ec +++ b/src/openvpn/crypto=2Ec @@ -1473,9 +1473,9 @@ = hex_byte[hb_index++] =3D c; if (hb_index =3D=3D= 2) { - uint8_t u; - = ASSERT(sscanf((const char *)hex_byte, "%" SCNx8, &u) =3D=3D 1)= ; - *out++ =3D u; + unsigned = int u; + ASSERT(sscanf((const char *)hex_byte, "%2x"= , &u) =3D=3D 1); + *out++ =3D (uint8_t)u; = hb_index =3D 0; if (++count =3D=3D = keylen) { diff --git a/src/openvpn/cryptoapi=2Ec b= /src/openvpn/cryptoapi=2Ec index bf80bbd=2E=2E0f95ab7 100644 --- a/src/open= vpn/cryptoapi=2Ec +++ b/src/openvpn/cryptoapi=2Ec @@ -169,10 +169,12 @@ = break; } - if (!isxdigit(p[0]) || !isxdigit(p[1= ]) || sscanf(p, "%2hhx", &arr[i++]) !=3D 1) + unsigned int b; + = if (!isxdigit(p[0]) || !isxdigit(p[1]) || sscanf(p, "%2x", &b) !=3D 1) = { return 0; } + arr[i++] =3D (unsigned= char)b; } return i; } -- To view, visit http://gerrit=2Eopenv= pn=2Enet/c/openvpn/+/1733?usp=3Demail To unsubscribe, or for help writing m= ail filters, visit http://gerrit=2Eopenvpn=2Enet/settings?usp=3Demail Gerr= it-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: master Ger= rit-Change-Id: I6595695ab6401047d498d530f8739686880bea3a Gerrit-Change-Numb= er: 1733 Gerrit-PatchSet: 1 Gerrit-Owner: d12fk Gerri= t-Reviewer: plaisthos Gerrit-CC: openvpn-devel= Gerrit-Attention: plaisthos --Nsi0inbli6I= Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos=2E

d12fk would like plaisthos to review this change=2E

View Change

mi=
ngw: avoid C99 "hh" scanf length modifier

read_key_file() = and parse_hexstring() parse hex bytes with sscanf()
using the C99 "= hh" length modifier, storing directly into an octet=2E

This is = not portable to the legacy MSVCRT runtime that Ubuntu
resolute's (26= =2E04) mingw toolchain links against=2E

Scan into an unsigned int an= d cast to the octet instead=2E The field width
caps the value at 0xFF, s= o the narrowing cast cannot lose data=2E

Change-Id: I6595695ab640104= 7d498d530f8739686880bea3a
Signed-off-by: Heiko Hund <heiko@ist=2Eeige= ntlich=2Enet>
---
M src/openvpn/crypto=2Ec
M src/openvpn/crypto= api=2Ec
2 files changed, 6 insertions(+), 4 deletions(-)

git pull ssh://gerrit=2Eopenvpn=2Enet:29418/openvpn refs/change= s/33/1733/1
diff --git a/src/openvpn/crypto=2Ec b/src/openvpn/crypt=
o=2Ec
index 7954e8a=2E=2Edb84a33 100644
---= a/src/openvpn/crypto=2Ec
+++ b/src/openvpn/crypto=2Ec
@@ -1473,9 +1473,9 @@
hex_= byte[hb_index++] =3D c;
if (hb_index = =3D=3D 2)
{
- uint8_t u;
- ASSERT(ssca= nf((const char *)hex_byte, "%" SCNx8, &u) =3D=3D 1);
- *out++= =3D u;
+ = unsigned int u;
+ ASSERT(sscanf((const char *)hex_byte, "= ;%2x", &u) =3D=3D 1);
+ *out++ =3D (uint8_t)u;
= hb_index =3D 0;
= if (++count =3D=3D keylen)
{=
diff --git a/src/openvpn/cryptoapi=2Ec b/src/openvpn/crypt= oapi=2Ec
index bf80bbd=2E=2E0f95ab7 100644
= --- a/src/openvpn/cryptoapi=2Ec
+++ b/src/openvpn/cryptoapi= =2Ec
@@ -169,10 +169,12 @@
bre= ak;
}

- if (!isxdigit(p[0]) || !isxdigit(p[1]) |= | sscanf(p, "%2hhx", &arr[i++]) !=3D 1)
+ unsigned int b;
+ if (!isxdigit(p[0]) || !isxdi= git(p[1]) || sscanf(p, "%2x", &b) !=3D 1)
= {
return 0;
}
+ arr[i++] =3D = (unsigned char)b;
}
return i;
}

To view, visit change 1733= =2E To unsubscribe, or for help writing mail filters, visit settings=2E

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerr= it-Branch: master
Gerrit-Change-Id: I65= 95695ab6401047d498d530f8739686880bea3a
= Gerrit-Change-Number: 1733
Gerrit-Patch= Set: 1
Gerrit-Owner: d12fk <heiko@op= envpn=2Enet>
Gerrit-Reviewer: plaist= hos <arne-openvpn@rfc2549=2Eorg>
= Gerrit-CC: openvpn-devel <openvpn-devel@lists=2Esourceforge=2Enet>
Gerrit-Attention: plaisthos <arne-open= vpn@rfc2549=2Eorg>
--Nsi0inbli6I=-- --===============1963762364173111471== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============1963762364173111471== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel --===============1963762364173111471==--