mirror of
https://github.com/openssl/openssl.git
synced 2024-11-21 01:15:20 +08:00
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)
This commit is contained in:
parent
b46de72c26
commit
a8df565115
@ -300,6 +300,8 @@ static int IPAddressOrRange_cmp(const IPAddressOrRange *a,
|
|||||||
return -1;
|
return -1;
|
||||||
prefixlen_a = length * 8;
|
prefixlen_a = length * 8;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (b->type) {
|
switch (b->type) {
|
||||||
@ -313,6 +315,8 @@ static int IPAddressOrRange_cmp(const IPAddressOrRange *a,
|
|||||||
return -1;
|
return -1;
|
||||||
prefixlen_b = length * 8;
|
prefixlen_b = length * 8;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((r = memcmp(addr_a, addr_b, length)) != 0)
|
if ((r = memcmp(addr_a, addr_b, length)) != 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user