summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorVikas Verma <131862931+vikasverma4795@users.noreply.github.com>2023-12-18 14:28:25 +0100
committerTomas Mraz <tomas@openssl.org>2023-12-19 18:24:21 +0100
commita8df5651153e8e81fbaa8408dd1137232168997d (patch)
treec9fea5efcb53e4b3a33623fa95b27ca239cef212 /crypto
parentLoongArch64 assembly pack: Fix ChaCha20 ABI breakage (diff)
downloadopenssl-a8df5651153e8e81fbaa8408dd1137232168997d.tar.xz
openssl-a8df5651153e8e81fbaa8408dd1137232168997d.zip
Update IPAddressOrRange_cmp function to handle switch case
As there is no default case for a->type or b->type in the switch() statements, if the type does not fall into any defined cases then memcmp() will be done on garbage data. Adding default cases in both switches. CLA: trivial Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23082)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/x509/v3_addr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/x509/v3_addr.c b/crypto/x509/v3_addr.c
index b990d54048..da9604cf96 100644
--- a/crypto/x509/v3_addr.c
+++ b/crypto/x509/v3_addr.c
@@ -300,6 +300,8 @@ static int IPAddressOrRange_cmp(const IPAddressOrRange *a,
return -1;
prefixlen_a = length * 8;
break;
+ default:
+ return -1;
}
switch (b->type) {
@@ -313,6 +315,8 @@ static int IPAddressOrRange_cmp(const IPAddressOrRange *a,
return -1;
prefixlen_b = length * 8;
break;
+ default:
+ return -1;
}
if ((r = memcmp(addr_a, addr_b, length)) != 0)