]> git.proxmox.com Git - mirror_qemu.git/commitdiff
net: avoid infinite loop when receiving packets(CVE-2015-5278)
authorP J P <pjp@fedoraproject.org>
Tue, 15 Sep 2015 11:16:59 +0000 (16:46 +0530)
committerStefan Hajnoczi <stefanha@redhat.com>
Tue, 15 Sep 2015 11:51:14 +0000 (12:51 +0100)
Ne2000 NIC uses ring buffer of NE2000_MEM_SIZE(49152)
bytes to process network packets. While receiving packets
via ne2000_receive() routine, a local 'index' variable
could exceed the ring buffer size, leading to an infinite
loop situation.

Reported-by: Qinghao Tang <luodalongde@gmail.com>
Signed-off-by: P J P <pjp@fedoraproject.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
hw/net/ne2000.c

index 3798a3b2f2998d7b256f301f54b47467d08c0581..010f9efccd53125ce9eb9f9440e0b757a0c93686 100644 (file)
@@ -247,7 +247,7 @@ ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_)
         if (index <= s->stop)
             avail = s->stop - index;
         else
-            avail = 0;
+            break;
         len = size;
         if (len > avail)
             len = avail;