]> xenbits.xensource.com Git - qemu-upstream-4.2-testing.git/commitdiff
net: avoid infinite loop when receiving packets(CVE-2015-5278)
authorP J P <pjp@fedoraproject.org>
Tue, 15 Sep 2015 14:29:21 +0000 (14:29 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Tue, 15 Sep 2015 14:37:38 +0000 (14:37 +0000)
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.

upstream-commit-id: 737d2b3c41d59eb8f94ab7eb419b957938f24943

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

index 0596896031f3d6a82b48cc3f2642a25769530f1b..7e1697538b338dd03ab928e581de6c56923c1d7a 100644 (file)
@@ -280,7 +280,7 @@ ssize_t ne2000_receive(VLANClientState *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;