-/* $OpenBSD: x509_addr.c,v 1.43 2021/12/28 20:50:37 tb Exp $ */
+/* $OpenBSD: x509_addr.c,v 1.44 2021/12/28 20:58:05 tb Exp $ */
/*
* Contributed to the OpenSSL Project by the American Registry for
* Internet Numbers ("ARIN").
int
X509v3_addr_canonize(IPAddrBlocks *addr)
{
+ unsigned int afi;
int i;
for (i = 0; i < sk_IPAddressFamily_num(addr); i++) {
IPAddressFamily *f = sk_IPAddressFamily_value(addr, i);
+
+ /* Check AFI/SAFI here - IPAddressFamily_cmp() can't error. */
+ if ((afi = X509v3_addr_get_afi(f)) == 0)
+ return 0;
+
if (f->ipAddressChoice->type ==
IPAddressChoice_addressesOrRanges &&
!IPAddressOrRanges_canonize(f->ipAddressChoice->u.addressesOrRanges,