]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
dummynet: Avoid an out-of-bounds read in do_config()
authorMark Johnston <markj@FreeBSD.org>
Mon, 29 Nov 2021 18:50:21 +0000 (13:50 -0500)
committerMark Johnston <markj@FreeBSD.org>
Mon, 6 Dec 2021 14:04:19 +0000 (09:04 -0500)
commit3f1756dabfe263c279c7dc29c54398d95f8b0988
tree530293598c813e57d08ca607fbdbbf0ef235c9b4
parentd0bcdb3e10ce9daafb439903fa9a87a17c8b77ac
dummynet: Avoid an out-of-bounds read in do_config()

do_config() processes a buffer of variable-length dummynet commands.
The loop which processes this buffer loads the fixed-length header
before checking whether there are any bytes left to read, so it performs
a 4-byte read past the end of the buffer before terminating.

Restructure the loop to avoid this.

Reported by: Jenkins (KASAN job)
Reviewed by: kp
Sponsored by: The FreeBSD Foundation

(cherry picked from commit d5ea04ee7ba6c7cd8e0918a080caf5f2c8fb3955)
sys/netpfil/ipfw/ip_dummynet.c