File CVE-2020-29130-qemut-out-of-bounds-access-while-processing-ARP-packets.patch of Package xen.25143

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.

Reported-by: Qiuhao Li <Qiuhao.Li at outlook.com>
Signed-off-by: Prasad J Pandit <pjp at fedoraproject.org>
---
 src/ncsi.c  | 4 ++++
 src/slirp.c | 4 ++++
 2 files changed, 8 insertions(+)

Index: xen-4.7.6-testing/tools/qemu-xen-traditional-dir-remote/slirp/slirp.c
===================================================================
--- xen-4.7.6-testing.orig/tools/qemu-xen-traditional-dir-remote/slirp/slirp.c
+++ xen-4.7.6-testing/tools/qemu-xen-traditional-dir-remote/slirp/slirp.c
@@ -604,6 +604,10 @@ static void arp_input(const uint8_t *pkt
     int ar_op;
     struct ex_list *ex_ptr;
 
+    if (pkt_len < ETH_HLEN + sizeof(struct arphdr)) {
+        return; /* packet too short */
+    }
+
     ar_op = ntohs(ah->ar_op);
     switch(ar_op) {
     case ARPOP_REQUEST:
openSUSE Build Service is sponsored by