summaryrefslogtreecommitdiff
path: root/lib/libcrypto/x509/x509_addr.c
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2021-12-28 19:59:34 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2021-12-28 19:59:34 +0000
commite6b03d0d6383da355d0e35506b4837d5c96dc06f (patch)
tree4ebd9573d7eb5c671c880176fc212d5f23f1871b /lib/libcrypto/x509/x509_addr.c
parent367570cfab2150e1ad4583c5e9e215425467b233 (diff)
Style improvements in X509v3_addr_add_range()
ok jsing
Diffstat (limited to 'lib/libcrypto/x509/x509_addr.c')
-rw-r--r--lib/libcrypto/x509/x509_addr.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/libcrypto/x509/x509_addr.c b/lib/libcrypto/x509/x509_addr.c
index 571ca728d4a..f0ef5b83116 100644
--- a/lib/libcrypto/x509/x509_addr.c
+++ b/lib/libcrypto/x509/x509_addr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509_addr.c,v 1.39 2021/12/28 19:56:45 tb Exp $ */
+/* $OpenBSD: x509_addr.c,v 1.40 2021/12/28 19:59:33 tb Exp $ */
/*
* Contributed to the OpenSSL Project by the American Registry for
* Internet Numbers ("ARIN").
@@ -982,17 +982,24 @@ int
X509v3_addr_add_range(IPAddrBlocks *addr, const unsigned afi,
const unsigned *safi, unsigned char *min, unsigned char *max)
{
- IPAddressOrRanges *aors = make_prefix_or_range(addr, afi, safi);
+ IPAddressOrRanges *aors;
IPAddressOrRange *aor;
- int length = length_from_afi(afi);
- if (aors == NULL)
+ int length;
+
+ if ((aors = make_prefix_or_range(addr, afi, safi)) == NULL)
return 0;
+
+ length = length_from_afi(afi);
+
if (!make_addressRange(&aor, min, max, length))
return 0;
- if (sk_IPAddressOrRange_push(aors, aor))
- return 1;
- IPAddressOrRange_free(aor);
- return 0;
+
+ if (sk_IPAddressOrRange_push(aors, aor) <= 0) {
+ IPAddressOrRange_free(aor);
+ return 0;
+ }
+
+ return 1;
}
/*