diff options
author | tb <> | 2021-12-28 20:44:56 +0000 |
---|---|---|
committer | tb <> | 2021-12-28 20:44:56 +0000 |
commit | 5b2b0b2e4ca91d6ecbeadee2ab34c05f3a4ebfbf (patch) | |
tree | f76d901323d0c16278755681dabdb7bbff17e5da /src/lib | |
parent | b2312e075fb4443cba28692fd6c6331e7ef2a749 (diff) | |
download | openbsd-5b2b0b2e4ca91d6ecbeadee2ab34c05f3a4ebfbf.tar.gz openbsd-5b2b0b2e4ca91d6ecbeadee2ab34c05f3a4ebfbf.tar.bz2 openbsd-5b2b0b2e4ca91d6ecbeadee2ab34c05f3a4ebfbf.zip |
Check AFI/SAFI before comparing them in X509v3_addr_is_canonical()
As mentioned in a previous commit, IPAddressFamily_cmp() can't really
check for trailing garbage in addressFamily->data. Since the path
validation and hence the X.509 validator call X509v3_addr_is_canonical(),
this deals with only partially validated data.
ok jsing
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/x509/x509_addr.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/libcrypto/x509/x509_addr.c b/src/lib/libcrypto/x509/x509_addr.c index 5f31d7307f..242d1b4982 100644 --- a/src/lib/libcrypto/x509/x509_addr.c +++ b/src/lib/libcrypto/x509/x509_addr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_addr.c,v 1.41 2021/12/28 20:07:17 tb Exp $ */ | 1 | /* $OpenBSD: x509_addr.c,v 1.42 2021/12/28 20:44:56 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Contributed to the OpenSSL Project by the American Registry for | 3 | * Contributed to the OpenSSL Project by the American Registry for |
4 | * Internet Numbers ("ARIN"). | 4 | * Internet Numbers ("ARIN"). |
@@ -1092,6 +1092,13 @@ X509v3_addr_is_canonical(IPAddrBlocks *addr) | |||
1092 | for (i = 0; i < sk_IPAddressFamily_num(addr) - 1; i++) { | 1092 | for (i = 0; i < sk_IPAddressFamily_num(addr) - 1; i++) { |
1093 | const IPAddressFamily *a = sk_IPAddressFamily_value(addr, i); | 1093 | const IPAddressFamily *a = sk_IPAddressFamily_value(addr, i); |
1094 | const IPAddressFamily *b = sk_IPAddressFamily_value(addr, i + 1); | 1094 | const IPAddressFamily *b = sk_IPAddressFamily_value(addr, i + 1); |
1095 | |||
1096 | /* Check that both have valid AFIs before comparing them. */ | ||
1097 | if (X509v3_addr_get_afi(a) == 0) | ||
1098 | return 0; | ||
1099 | if (X509v3_addr_get_afi(b) == 0) | ||
1100 | return 0; | ||
1101 | |||
1095 | if (IPAddressFamily_cmp(&a, &b) >= 0) | 1102 | if (IPAddressFamily_cmp(&a, &b) >= 0) |
1096 | return 0; | 1103 | return 0; |
1097 | } | 1104 | } |