summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2022-02-11 17:41:55 +0000
committertb <>2022-02-11 17:41:55 +0000
commita345ec92b1fce7cf942a7fc858ad531f08cafc5a (patch)
tree23f048278791a6087f8f2068d8a8764eaf97d778 /src/lib
parent0bb62745ea220d7a3081409f24ecf9731a7f7afb (diff)
downloadopenbsd-a345ec92b1fce7cf942a7fc858ad531f08cafc5a.tar.gz
openbsd-a345ec92b1fce7cf942a7fc858ad531f08cafc5a.tar.bz2
openbsd-a345ec92b1fce7cf942a7fc858ad531f08cafc5a.zip
Fix length check of IP addresses for name constraints
An IP address in a name constraint is actually an IP address concatenated with a netmask, so it is twice as long as usual. This fixes a third bug introduced in r1.3 and reported by Volker Schlecht ok jsing
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/x509/x509_alt.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libcrypto/x509/x509_alt.c b/src/lib/libcrypto/x509/x509_alt.c
index 52d30f91e8..4de6a09101 100644
--- a/src/lib/libcrypto/x509/x509_alt.c
+++ b/src/lib/libcrypto/x509/x509_alt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_alt.c,v 1.7 2022/02/11 17:39:36 tb Exp $ */ 1/* $OpenBSD: x509_alt.c,v 1.8 2022/02/11 17:41:55 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -677,7 +677,8 @@ v2i_GENERAL_NAME_ex(GENERAL_NAME *out, const X509V3_EXT_METHOD *method,
677 } 677 }
678 break; 678 break;
679 case GEN_IPADD: 679 case GEN_IPADD:
680 if (len != 4 && len != 16) { 680 if ((!is_nc && len != 4 && len != 16) ||
681 (is_nc && len != 8 && len != 32)) {
681 X509V3error(X509V3_R_BAD_IP_ADDRESS); 682 X509V3error(X509V3_R_BAD_IP_ADDRESS);
682 ERR_asprintf_error_data("name=%s len=%zu", name, len); 683 ERR_asprintf_error_data("name=%s len=%zu", name, len);
683 goto err; 684 goto err;