From: "cron2 (Code Review)" Date: Sat, 8 Nov 2025 22:59:41 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <32038c69d9a057aa6263de50744e829aefa1cf9e-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="ehpbJomWPAw="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: pkcs11_openssl: Silence a conversion warning List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --ehpbJomWPAw= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#2) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1352?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: pkcs11_openssl: Silence a conversion warning ...................................................................... pkcs11_openssl: Silence a conversion warning The only caller of this function uses a constant for this parameter, so this is all quite safe. Add an ASSERT for good measure anyway to make the assumption explicit. Change-Id: I6079bf9e7f6b37cb2e2d7f28851a77d0b08be995 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1352 Message-Id: <20251106133936.30264-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34= 209.html Signed-off-by: Gert Doering --- M src/openvpn/pkcs11_openssl.c 1 file changed, 2 insertions(+), 11 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/52/1352/2 diff --git a/src/openvpn/pkcs11_openssl.c b/src/openvpn/pkcs11_openssl.c index f619b95..1d527db 100644 --- a/src/openvpn/pkcs11_openssl.c +++ b/src/openvpn/pkcs11_openssl.c @@ -428,18 +428,12 @@ return dn; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - int pkcs11_certificate_serial(pkcs11h_certificate_t certificate, char *serial,= size_t serial_len) { X509 *x509 =3D NULL; BIO *bio =3D NULL; int ret =3D 1; - int n; if ((x509 =3D pkcs11h_openssl_getX509(certificate)) =3D=3D NULL) { @@ -454,7 +448,8 @@ } i2a_ASN1_INTEGER(bio, X509_get_serialNumber(x509)); - n =3D BIO_read(bio, serial, serial_len - 1); + ASSERT(serial_len <=3D INT_MAX); + int n =3D BIO_read(bio, serial, (int)serial_len - 1); if (n < 0) { @@ -474,8 +469,4 @@ return ret; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - #endif /* defined(ENABLE_PKCS11) && defined(ENABLE_OPENSSL) */ -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1352?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I6079bf9e7f6b37cb2e2d7f28851a77d0b08be995 Gerrit-Change-Number: 1352 Gerrit-PatchSet: 2 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --ehpbJomWPAw= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #2 to the change originally created by flichtenhel= d.

View Change

The following approvals got outdated and were remove= d: Code-Review+2 by cron2

pkcs11_openssl: Silence a conversio=
n warning

The only caller of this function uses a constant
for th= is parameter, so this is all quite safe. Add
an ASSERT for good measure = anyway to make the assumption
explicit.

Change-Id: I6079bf9e7f6b3= 7cb2e2d7f28851a77d0b08be995
Signed-off-by: Frank Lichtenheld <frank@...220...= ..2641...>
Acked-by: Gert Doering <gert@...1296...>
Gerrit U= RL: https://gerrit.openvpn.net/c/openvpn/+/1352
Message-Id: <20251106= 133936.30264-1-gert@...1296...>
URL: https://www.mail-archive.com/ope= nvpn-devel@lists.sourceforge.net/msg34209.html
Signed-off-by: Gert Doeri= ng <gert@...1296...>
---
M src/openvpn/pkcs11_openssl.c
1 fi= le changed, 2 insertions(+), 11 deletions(-)

git=
 pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/52/1352/2
diff --git a/src/openvpn/pkcs11_openssl.c b/src/openvpn/pkcs11_openssl.c
index f619b95..1d527db 100644
--- a/src/open= vpn/pkcs11_openssl.c
+++ b/src/openvpn/pkcs11_openssl.c
@@ -428,18 +428,12 @@
return dn; }

-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wc= onversion"
-#endif=
-
int=
pkcs11_certificate_serial(pkcs11h_certificate_t certifica= te, char *serial, size_t serial_len)
{
= X509 *x509 =3D NULL;
BIO *bio =3D NULL;
int ret =3D 1;

- int n;

if ((x509 =3D pkcs11h_o= penssl_getX509(certificate)) =3D=3D NULL)
{
= @@ -454,7 +448,8 @@
}
i2a_ASN1_INTEGER(bio, X509_get_serialNumber(x509));
= - n =3D BIO_read(bio, serial, = serial_len - 1);
+ = ASSERT(serial_len <=3D INT_MAX);
+ int n =3D BIO_read(bio, serial, (int)serial_len - 1);<= /span>

if (n < 0)
{=
@@ -474,8 +469,4 @@
return ret;

}

-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
#endif /* defined(ENABLE_PKCS11) &a= mp;& defined(ENABLE_OPENSSL) */

To = view, visit change 1352. To unsubscribe, or for help writing mail filters, visi= t settings.<= /p>

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6079bf9e7f6b37cb2e2d7f28851= a77d0b08be995
Gerrit-Change-Number: 1352
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --ehpbJomWPAw=--