mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 09:10:28 +00:00
igmp: Avoid an out-of-bounds access when zeroing counters
When verifying, byte-by-byte, that the user-supplied counters are zero-filled, sysctl_igmp_stat() would check for zero before checking the loop bound. Perform the checks in the correct order. Reported by: KASAN MFC after: 1 week Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
9a7c2de364
commit
6c34dde83e
|
@ -382,7 +382,7 @@ sysctl_igmp_stat(SYSCTL_HANDLER_ARGS)
|
|||
* igps0 must be "all zero".
|
||||
*/
|
||||
p = (char *)&igps0;
|
||||
while (*p == '\0' && p < (char *)&igps0 + sizeof(igps0))
|
||||
while (p < (char *)&igps0 + sizeof(igps0) && *p == '\0')
|
||||
p++;
|
||||
if (p != (char *)&igps0 + sizeof(igps0)) {
|
||||
error = EINVAL;
|
||||
|
|
Loading…
Reference in a new issue