Change in openvpn[master]: extract_x509_field_ssl(): verify that X509_NAME is not NULL.
A message that is not in the archive (sent off-list or not yet received): gerrit.1763838359000.I1e9c7eee06bf5f2e8aed8cd2523684539294ac8b@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1388?usp=email
to review the following change.
Change subject: extract_x509_field_ssl(): verify that X509_NAME is not NULL.
......................................................................
extract_x509_field_ssl(): verify that X509_NAME is not NULL.
This seems to be unlikely to ever happen, but this check won't harm.
While at it, fix pre-C99 local-variable indent block.
---
M src/openvpn/ssl_verify_openssl.c
1 file changed, 10 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/88/1388/1
src/openvpn/ssl_verify_openssl.c +10 -6
@@ -202,8 +202,14 @@X509_NAME_ENTRY *x509ne =NULL ;ASN1_STRING *asn1 =NULL ;unsigned char *buf =NULL ; -ASN1_OBJECT *field_name_obj =OBJ_txt2obj (field_name,0 ); +if (x509 ==NULL ) + { +msg (D_TLS_ERRORS ,"X509 subject name is NULL" ); +return FAILURE ; + } + +ASN1_OBJECT *field_name_obj =OBJ_txt2obj (field_name,0 );if (field_name_obj ==NULL ) {msg (D_TLS_ERRORS ,"Invalid X509 attribute name '%s'" , field_name);
@@ -244,11 +250,9 @@strncpynt (out, (char *)buf, size); - { -const result_t ret = (strlen ((char *)buf) < size) ?SUCCESS :FAILURE ; -OPENSSL_free (buf); -return ret; - } +const result_t ret = (strlen ((char *)buf) < size) ?SUCCESS :FAILURE ; +OPENSSL_free (buf); +return ret; } result_t
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1388?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1e9c7eee06bf5f2e8aed8cd2523684539294ac8b
Gerrit-Change-Number: 1388
Gerrit-PatchSet: 1
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: cron2, plaisthos.
ordex has posted comments on this change by cron2. ( http://gerrit.openvpn.net/c/openvpn/+/1388?usp=email )
Change subject: extract_x509_field_ssl(): verify that X509_NAME is not NULL.
......................................................................
Patch Set 1: Code-Review-1
(1 comment)
File src/openvpn/ssl_verify_openssl.c:
http://gerrit.openvpn.net/c/openvpn/+/1388/comment/d4be6f27_e032b011?usp=email :
PS1, Line 206: if (x509 == NULL)
we normally assume parameters are valid and don't do NULL checks right at the beginning of the function body.
therefore we should check the return value of X509_get_subject_name() before calling extract_x509_field_ssl() in backend_x509_get_username()
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1388?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1e9c7eee06bf5f2e8aed8cd2523684539294ac8b
Gerrit-Change-Number: 1388
Gerrit-PatchSet: 1
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Comment-Date: Thu, 27 Nov 2025 10:01:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: cron2, ordex, plaisthos.
Hello ordex, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1388?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review-1 by ordex
Change subject: extract_x509_field_ssl(): verify that X509_NAME is not NULL.
......................................................................
extract_x509_field_ssl(): verify that X509_NAME is not NULL.
This seems to be unlikely to ever happen, but this check won't harm
- as a matter of coding convention, we do not ensure this inside extract_x509_field_ssl(), but in the (single) caller.
While at it, fix pre-C99 local-variable indent block, and missing {} block in else/#endif construction.
---
M src/openvpn/ssl_verify_openssl.c
1 file changed, 14 insertions(+), 7 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/88/1388/2
src/openvpn/ssl_verify_openssl.c +14 -7
@@ -202,8 +202,8 @@X509_NAME_ENTRY *x509ne =NULL ;ASN1_STRING *asn1 =NULL ;unsigned char *buf =NULL ; -ASN1_OBJECT *field_name_obj =OBJ_txt2obj (field_name,0 ); +ASN1_OBJECT *field_name_obj =OBJ_txt2obj (field_name,0 );if (field_name_obj ==NULL ) {msg (D_TLS_ERRORS ,"Invalid X509 attribute name '%s'" , field_name);
@@ -244,11 +244,9 @@strncpynt (out, (char *)buf, size); - { -const result_t ret = (strlen ((char *)buf) < size) ?SUCCESS :FAILURE ; -OPENSSL_free (buf); -return ret; - } +const result_t ret = (strlen ((char *)buf) < size) ?SUCCESS :FAILURE ; +OPENSSL_free (buf); +return ret; } result_t
@@ -278,12 +276,21 @@ } else#endif /* ifdef ENABLE_X509ALTUSERNAME */ + { +X509_NAME *x509_subject_name =X509_get_subject_name (peer_cert); +if (x509_subject_name ==NULL ) + { +msg (D_TLS_ERRORS ,"X509 subject name is NULL" ); +return FAILURE ; + } +if (FAILURE - ==extract_x509_field_ssl (X509_get_subject_name (peer_cert), x509_username_field, + ==extract_x509_field_ssl (x509_subject_name, x509_username_field, common_name, cn_len)) {return FAILURE ; } + }return SUCCESS ; }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1388?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1e9c7eee06bf5f2e8aed8cd2523684539294ac8b
Gerrit-Change-Number: 1388
Gerrit-PatchSet: 2
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Attention is currently required from: ordex, plaisthos.
cron2 has posted comments on this change by cron2. ( http://gerrit.openvpn.net/c/openvpn/+/1388?usp=email )
Change subject: extract_x509_field_ssl(): verify that X509_NAME is not NULL.
......................................................................
Patch Set 2:
(1 comment)
File src/openvpn/ssl_verify_openssl.c:
http://gerrit.openvpn.net/c/openvpn/+/1388/comment/4d7b26d7_d7771ef6?usp=email :
PS1, Line 206: if (x509 == NULL)
Quoted 1 line
we normally assume parameters are valid and don't do NULL checks right at the beginning of the funct […]
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1388?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1e9c7eee06bf5f2e8aed8cd2523684539294ac8b
Gerrit-Change-Number: 1388
Gerrit-PatchSet: 2
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Thu, 27 Nov 2025 10:34:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: ordex <[email protected]...>
Attention is currently required from: cron2, plaisthos.
ordex has posted comments on this change by cron2. ( http://gerrit.openvpn.net/c/openvpn/+/1388?usp=email )
Change subject: extract_x509_field_ssl(): verify that X509_NAME is not NULL.
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1388?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1e9c7eee06bf5f2e8aed8cd2523684539294ac8b
Gerrit-Change-Number: 1388
Gerrit-PatchSet: 2
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Comment-Date: Thu, 27 Nov 2025 11:34:27 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH v2 1/1 extract_x509_field_ssl(): verify that X509_NAME is not NULL.
In reply to a message not in the archiveThis seems to be unlikely to ever happen, but this check won't harm
- as a matter of coding convention, we do not ensure this inside extract_x509_field_ssl(), but in the (single) caller.
While at it, fix pre-C99 local-variable indent block, and missing {} block in else/#endif construction.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1388
---
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/+/1388
This mail reflects revision 2 of this Change.
Acked-by according to Gerrit (reflected above):
Antonio Quartulli <[email protected]...>
src/openvpn/ssl_verify_openssl.c +14 -7
@@ -202,8 +202,8 @@X509_NAME_ENTRY *x509ne =NULL ;ASN1_STRING *asn1 =NULL ;unsigned char *buf =NULL ; -ASN1_OBJECT *field_name_obj =OBJ_txt2obj (field_name,0 ); +ASN1_OBJECT *field_name_obj =OBJ_txt2obj (field_name,0 );if (field_name_obj ==NULL ) {msg (D_TLS_ERRORS ,"Invalid X509 attribute name '%s'" , field_name);
@@ -244,11 +244,9 @@strncpynt (out, (char *)buf, size); - { -const result_t ret = (strlen ((char *)buf) < size) ?SUCCESS :FAILURE ; -OPENSSL_free (buf); -return ret; - } +const result_t ret = (strlen ((char *)buf) < size) ?SUCCESS :FAILURE ; +OPENSSL_free (buf); +return ret; } result_t
@@ -278,12 +276,21 @@ } else#endif /* ifdef ENABLE_X509ALTUSERNAME */ + { +X509_NAME *x509_subject_name =X509_get_subject_name (peer_cert); +if (x509_subject_name ==NULL ) + { +msg (D_TLS_ERRORS ,"X509 subject name is NULL" ); +return FAILURE ; + } +if (FAILURE - ==extract_x509_field_ssl (X509_get_subject_name (peer_cert), x509_username_field, + ==extract_x509_field_ssl (x509_subject_name, x509_username_field, common_name, cn_len)) {return FAILURE ; } + }return SUCCESS ; }
[Openvpn-devel] [PATCH applied] Re: extract_x509_field_ssl(): verify that X509_NAME is not NULL.
Only subjected to basic t_client tests - this extracts the subject name to print it, so things still work for the non-error case (and I have no cert that would trigger the error case).
Opened github #917 to start a discussion about the ENABLE_X509ALTUSERNAME conditional... (one cannot simply touch OpenVPN code without finding things :-/ )
Your patch has been applied to the master branch.
commit f18e3141fae709fff47b82d7931024249ba09cc1
Author: Gert Doering Date: Thu Nov 27 12:35:12 2025 +0100
extract_x509_field_ssl(): verify that X509_NAME is not NULL.
Signed-off-by: Gert Doering <[email protected]...>
Acked-by: Antonio Quartulli <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1388
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34748.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Hello ordex, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1388?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Code-Review+2 by ordex
Change subject: extract_x509_field_ssl(): verify that X509_NAME is not NULL.
......................................................................
extract_x509_field_ssl(): verify that X509_NAME is not NULL.
This seems to be unlikely to ever happen, but this check won't harm
- as a matter of coding convention, we do not ensure this inside extract_x509_field_ssl(), but in the (single) caller.
While at it, fix pre-C99 local-variable indent block, and missing {} block in else/#endif construction.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1388
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34748.html
---
M src/openvpn/ssl_verify_openssl.c
1 file changed, 14 insertions(+), 7 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/88/1388/3
src/openvpn/ssl_verify_openssl.c +14 -7
@@ -202,8 +202,8 @@X509_NAME_ENTRY *x509ne =NULL ;ASN1_STRING *asn1 =NULL ;unsigned char *buf =NULL ; -ASN1_OBJECT *field_name_obj =OBJ_txt2obj (field_name,0 ); +ASN1_OBJECT *field_name_obj =OBJ_txt2obj (field_name,0 );if (field_name_obj ==NULL ) {msg (D_TLS_ERRORS ,"Invalid X509 attribute name '%s'" , field_name);
@@ -244,11 +244,9 @@strncpynt (out, (char *)buf, size); - { -const result_t ret = (strlen ((char *)buf) < size) ?SUCCESS :FAILURE ; -OPENSSL_free (buf); -return ret; - } +const result_t ret = (strlen ((char *)buf) < size) ?SUCCESS :FAILURE ; +OPENSSL_free (buf); +return ret; } result_t
@@ -278,12 +276,21 @@ } else#endif /* ifdef ENABLE_X509ALTUSERNAME */ + { +X509_NAME *x509_subject_name =X509_get_subject_name (peer_cert); +if (x509_subject_name ==NULL ) + { +msg (D_TLS_ERRORS ,"X509 subject name is NULL" ); +return FAILURE ; + } +if (FAILURE - ==extract_x509_field_ssl (X509_get_subject_name (peer_cert), x509_username_field, + ==extract_x509_field_ssl (x509_subject_name, x509_username_field, common_name, cn_len)) {return FAILURE ; } + }return SUCCESS ; }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1388?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1e9c7eee06bf5f2e8aed8cd2523684539294ac8b
Gerrit-Change-Number: 1388
Gerrit-PatchSet: 3
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1388?usp=email )
Change subject: extract_x509_field_ssl(): verify that X509_NAME is not NULL.
......................................................................
extract_x509_field_ssl(): verify that X509_NAME is not NULL.
This seems to be unlikely to ever happen, but this check won't harm
- as a matter of coding convention, we do not ensure this inside extract_x509_field_ssl(), but in the (single) caller.
While at it, fix pre-C99 local-variable indent block, and missing {} block in else/#endif construction.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1388
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34748.html
---
M src/openvpn/ssl_verify_openssl.c
1 file changed, 14 insertions(+), 7 deletions(-)
src/openvpn/ssl_verify_openssl.c +14 -7
@@ -202,8 +202,8 @@X509_NAME_ENTRY *x509ne =NULL ;ASN1_STRING *asn1 =NULL ;unsigned char *buf =NULL ; -ASN1_OBJECT *field_name_obj =OBJ_txt2obj (field_name,0 ); +ASN1_OBJECT *field_name_obj =OBJ_txt2obj (field_name,0 );if (field_name_obj ==NULL ) {msg (D_TLS_ERRORS ,"Invalid X509 attribute name '%s'" , field_name);
@@ -244,11 +244,9 @@strncpynt (out, (char *)buf, size); - { -const result_t ret = (strlen ((char *)buf) < size) ?SUCCESS :FAILURE ; -OPENSSL_free (buf); -return ret; - } +const result_t ret = (strlen ((char *)buf) < size) ?SUCCESS :FAILURE ; +OPENSSL_free (buf); +return ret; } result_t
@@ -278,12 +276,21 @@ } else#endif /* ifdef ENABLE_X509ALTUSERNAME */ + { +X509_NAME *x509_subject_name =X509_get_subject_name (peer_cert); +if (x509_subject_name ==NULL ) + { +msg (D_TLS_ERRORS ,"X509 subject name is NULL" ); +return FAILURE ; + } +if (FAILURE - ==extract_x509_field_ssl (X509_get_subject_name (peer_cert), x509_username_field, + ==extract_x509_field_ssl (x509_subject_name, x509_username_field, common_name, cn_len)) {return FAILURE ; } + }return SUCCESS ; }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1388?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1e9c7eee06bf5f2e8aed8cd2523684539294ac8b
Gerrit-Change-Number: 1388
Gerrit-PatchSet: 3
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>