summaryrefslogtreecommitdiff
path: root/thirdparty/openssl/crypto/x509v3/v3_addr.c
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/openssl/crypto/x509v3/v3_addr.c')
-rw-r--r--thirdparty/openssl/crypto/x509v3/v3_addr.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/thirdparty/openssl/crypto/x509v3/v3_addr.c b/thirdparty/openssl/crypto/x509v3/v3_addr.c
index 1290dec9bb..af080a04f2 100644
--- a/thirdparty/openssl/crypto/x509v3/v3_addr.c
+++ b/thirdparty/openssl/crypto/x509v3/v3_addr.c
@@ -130,10 +130,12 @@ static int length_from_afi(const unsigned afi)
*/
unsigned int v3_addr_get_afi(const IPAddressFamily *f)
{
- return ((f != NULL &&
- f->addressFamily != NULL && f->addressFamily->data != NULL)
- ? ((f->addressFamily->data[0] << 8) | (f->addressFamily->data[1]))
- : 0);
+ if (f == NULL
+ || f->addressFamily == NULL
+ || f->addressFamily->data == NULL
+ || f->addressFamily->length < 2)
+ return 0;
+ return (f->addressFamily->data[0] << 8) | f->addressFamily->data[1];
}
/*