From 93060258ae748573ca7197204125a2670047896d Mon Sep 17 00:00:00 2001 From: Li Qiang Date: Tue, 9 Aug 2016 16:49:47 +0530 Subject: net: vmxnet: check IP header length Vmxnet3 device emulator when parsing packet headers does not check for IP header length. It could lead to a OOB access when reading further packet data. Add check to avoid it. Reported-by: Li Qiang Signed-off-by: Prasad J Pandit Reviewed-by: Dmitry Fleytman Signed-off-by: Michael Roth --- hw/net/vmxnet_tx_pkt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/net/vmxnet_tx_pkt.c b/hw/net/vmxnet_tx_pkt.c index f4d0f5f..5ba2f5e 100644 --- a/hw/net/vmxnet_tx_pkt.c +++ b/hw/net/vmxnet_tx_pkt.c @@ -178,6 +178,11 @@ static bool vmxnet_tx_pkt_parse_headers(struct VmxnetTxPkt *pkt) } l3_hdr->iov_len = IP_HDR_GET_LEN(l3_hdr->iov_base); + if(l3_hdr->iov_len < sizeof(struct ip_header)) + { + l3_hdr->iov_len = 0; + return false; + } pkt->l4proto = ((struct ip_header *) l3_hdr->iov_base)->ip_p; /* copy optional IPv4 header data */ -- cgit v1.1