Commit 2e1dcbc0 authored by Prasad J Pandit's avatar Prasad J Pandit Committed by Marc-André Lureau
Browse files

slirp: check pkt_len before reading protocol header

While processing ARP/NCSI packets in 'arp_input' or 'ncsi_input'
routines, ensure that pkt_len is large enough to accommodate the
respective protocol headers, lest it should do an OOB access.
Add check to avoid it.

CVE-2020-29129 CVE-2020-29130
  QEMU: slirp: out-of-bounds access while processing ARP/NCSI packets

Reported-by: Qiuhao Li's avatarQiuhao Li <>
Signed-off-by: default avatarPrasad J Pandit <>
Message-Id: <>
Reviewed-by: default avatarMarc-André Lureau <>
parent 55e83caf
......@@ -148,6 +148,10 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
uint32_t checksum;
uint32_t *pchecksum;
if (pkt_len < ETH_HLEN + sizeof(struct ncsi_pkt_hdr)) {
return; /* packet too short */
memset(ncsi_reply, 0, sizeof(ncsi_reply));
memset(reh->h_dest, 0xff, ETH_ALEN);
......@@ -860,6 +860,10 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
if (pkt_len < ETH_HLEN + sizeof(struct slirp_arphdr)) {
return; /* packet too short */
ar_op = ntohs(ah->ar_op);
switch (ar_op) {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment