From: "cron2 (Code Review)" Date: Tue, 10 Mar 2026 08:27:25 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <6dc427189c3923af6faeda75ccb738f259542bfb-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="Z7T8NJiZOWw="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: ssl_verify_openssl: Clean up extract_x509_extension List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --Z7T8NJiZOWw= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#8) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1507?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by plaisthos Change subject: ssl_verify_openssl: Clean up extract_x509_extension ...................................................................... ssl_verify_openssl: Clean up extract_x509_extension * Avoid sign-compare warning when comparing string lengths * Use the nicer alias rfc822Name instead of the general ia5 from the GENERAL_NAME union. * Use the official ASN1_STRING_length API instead of accessing the struct directly. * C11 changes Change-Id: I23cc00aee47aef007ab2e7d50b52c6de299505db Signed-off-by: Frank Lichtenheld Acked-by: Arne Schwabe Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1507 Message-Id: <20260309133236.29732-1-frank@...2641...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35= 980.html Signed-off-by: Gert Doering --- M src/openvpn/ssl_verify_openssl.c 1 file changed, 6 insertions(+), 17 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/07/1507/8 diff --git a/src/openvpn/ssl_verify_openssl.c b/src/openvpn/ssl_verify_open= ssl.c index 58f665c..46401cd 100644 --- a/src/openvpn/ssl_verify_openssl.c +++ b/src/openvpn/ssl_verify_openssl.c @@ -118,16 +118,10 @@ return nid =3D=3D NID_subject_alt_name || nid =3D=3D NID_issuer_alt_na= me; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-compare" -#endif - static bool extract_x509_extension(X509 *cert, char *fieldname, char *out, size_t size) { bool retval =3D false; - char *buf =3D 0; if (!x509_username_field_ext_supported(fieldname)) { @@ -139,29 +133,28 @@ GENERAL_NAMES *extensions =3D X509_get_ext_d2i(cert, nid, NULL, NULL); if (extensions) { - int numalts; - int i; /* get amount of alternatives, * RFC2459 claims there MUST be at least * one, but we don't depend on it... */ - numalts =3D sk_GENERAL_NAME_num(extensions); + int numalts =3D sk_GENERAL_NAME_num(extensions); /* loop through all alternatives */ - for (i =3D 0; i < numalts; i++) + for (int i =3D 0; i < numalts; i++) { /* get a handle to alternative name number i */ const GENERAL_NAME *name =3D sk_GENERAL_NAME_value(extensions,= i); + char *buf =3D NULL; switch (name->type) { case GEN_EMAIL: - if (ASN1_STRING_to_UTF8((unsigned char **)&buf, name->= d.ia5) < 0) + if (ASN1_STRING_to_UTF8((unsigned char **)&buf, name->= d.rfc822Name) < 0) { continue; } - if (strlen(buf) !=3D name->d.ia5->length) + if ((ssize_t)strlen(buf) !=3D ASN1_STRING_length(name-= >d.rfc822Name)) { msg(D_TLS_ERRORS, "ASN1 ERROR: string contained te= rminating zero"); OPENSSL_free(buf); @@ -175,7 +168,7 @@ break; default: - msg(D_TLS_DEBUG, "%s: ignoring general name field type= %i", __func__, + msg(D_TLS_DEBUG, "%s: ignoring general name field type= %d", __func__, name->type); break; } @@ -185,10 +178,6 @@ return retval; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - /* * Extract a field from an X509 subject name. * -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1507?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: I23cc00aee47aef007ab2e7d50b52c6de299505db Gerrit-Change-Number: 1507 Gerrit-PatchSet: 8 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --Z7T8NJiZOWw= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

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

View Change

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

ssl_verify_openssl: Clean up ex=
tract_x509_extension

* Avoid sign-compare warning when comparing str= ing
lengths
* Use the nicer alias rfc822Name instead of the general= ia5
from the GENERAL_NAME union.
* Use the official ASN1_STRING_le= ngth API instead of accessing
the struct directly.
* C11 changes
Change-Id: I23cc00aee47aef007ab2e7d50b52c6de299505db
Signed-off-by:= Frank Lichtenheld <frank@...2641...>
Acked-by: Arne Schwabe <a= rne-openvpn@...1227...>
Gerrit URL: https://gerrit.openvpn.net/c/open= vpn/+/1507
Message-Id: <20260309133236.29732-1-frank@...2641...>URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg= 35980.html
Signed-off-by: Gert Doering <gert@...1296...>
---M src/openvpn/ssl_verify_openssl.c
1 file changed, 6 insertions(+), 17 = deletions(-)

git pull ssh://gerrit.openvpn.net:2=
9418/openvpn refs/changes/07/1507/8
diff --git a/src/openvpn/ssl_ve=
rify_openssl.c b/src/openvpn/ssl_verify_openssl.c
index 58f= 665c..46401cd 100644
--- a/src/openvpn/ssl_verify_openssl.c=
+++ b/src/openvpn/ssl_verify_openssl.c
@@ = -118,16 +118,10 @@
return nid =3D=3D NID_subject_alt_n= ame || nid =3D=3D NID_issuer_alt_name;
}
=
-#if defined(__GNUC__)= || defined(__clang__)
= -#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
= -#endif
-
static bool
= extract_x509_extension(X509 *cert, char *fieldname, char *out, size_t size)=
{
bool retval =3D false;
<= span style=3D"color: hsl(0, 100%, 40%);">- char *buf =3D 0;

if (!x509_username_field_ext_supported(fieldname= ))
{
@@ -139,29 +133,28 @@
<= span> GENERAL_NAMES *extensions =3D X509_get_ext_d2i(cert, nid, NULL, N= ULL);
if (extensions)
{- int numalts;
= - int i;
= /* get amount of alternatives,
* RFC2459 = claims there MUST be at least
* one, but we don&#= 39;t depend on it...
*/
<= br>- numalts =3D sk_GENERA= L_NAME_num(extensions);
+ int numalts =3D sk_GENERAL_NAME_num(extensions);

/* loop through all alternatives */
= - for (i =3D 0; i < num= alts; i++)
+ f= or (int i =3D 0; i < numalts; i++)
{
= /* get a handle to alternative name number i */ const GENERAL_NAME *name =3D sk_GENERAL_NAME_value(ext= ensions, i);
+ = char *buf =3D NULL;

swi= tch (name->type)
{
= case GEN_EMAIL:
+ if (ASN1_STRING_to_UTF8((unsigned char **)&buf,= name->d.rfc822Name) < 0)
{

continue;
= }
- = if (strlen(buf) !=3D name->d.ia5->length)
+ if ((ssize_t)strle= n(buf) !=3D ASN1_STRING_length(name->d.rfc822Name))
= {
msg(D_TLS_ERROR= S, "ASN1 ERROR: string contained terminating zero");
OPENSSL_free(buf);
@@ -175,7 += 168,7 @@
break;

default:
- msg(D_TLS_DEBUG, "%s: ignoring gen= eral name field type %i", __func__,
+ msg(D_TLS_DEBUG, "%s: ignorin= g general name field type %d", __func__,
= name->type);
break;
}
@@ -185,10 +178,6 @@
= return retval;
}

-#if defined(__GNUC__) || defined(_= _clang__)

-#pragma GCC = diagnostic pop
-#endif<= /span>
-
/*
* Extract a field from an X509 subject name.
*


To view, visit change 1507. To unsub= scribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I23cc00aee47aef007ab2e7d50b5= 2c6de299505db
Gerrit-Change-Number: 1507
Gerrit-PatchSet: 8
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --Z7T8NJiZOWw=--