virtio-net: Fix size check in dhclient workaround
authorAkihiko Odaki <akihiko.odaki@daynix.com>
Fri, 22 Nov 2024 05:03:08 +0000 (14:03 +0900)
committerJason Wang <jasowang@redhat.com>
Mon, 25 Nov 2024 06:00:04 +0000 (14:00 +0800)
commita8575f7fb2f213e6690b23160b04271d47fdfaa8
treeac185cec3832abb352de466e34670ca43069a212
parent5930e5ccf38158b090f38554994dab604f01f017
virtio-net: Fix size check in dhclient workaround

work_around_broken_dhclient() accesses IP and UDP headers to detect
relevant packets and to calculate checksums, but it didn't check if
the packet has size sufficient to accommodate them, causing out-of-bound
access hazards. Fix this by correcting the size requirement.

Fixes: 1d41b0c1ec66 ("Work around dhclient brokenness")
Cc: qemu-stable@nongnu.org
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
hw/net/virtio-net.c