f7153f0
From: Prasad J Pandit <address@hidden>
f7153f0
f7153f0
Ne2000 NIC uses ring buffer of NE2000_MEM_SIZE(49152)
f7153f0
bytes to process network packets. Registers PSTART & PSTOP
f7153f0
define ring buffer size & location. Setting these registers
f7153f0
to invalid values could lead to infinite loop or OOB r/w
f7153f0
access issues. Add check to avoid it.
f7153f0
f7153f0
Reported-by: Yang Hongke <address@hidden>
f7153f0
Signed-off-by: Prasad J Pandit <address@hidden>
f7153f0
---
f7153f0
 hw/net/ne2000.c | 4 ++++
f7153f0
 1 file changed, 4 insertions(+)
f7153f0
f7153f0
Update per review:
f7153f0
  -> https://lists.gnu.org/archive/html/qemu-devel/2016-02/msg05522.html
f7153f0
f7153f0
diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
f7153f0
index b032212..ced4666 100644
f7153f0
--- a/tools/qemu-xen-traditional/hw/ne2000.c
f7153f0
+++ b/tools/qemu-xen-traditional/hw/ne2000.c
f7153f0
@@ -154,6 +154,10 @@ static int ne2000_buffer_full(NE2000State *s)
f7153f0
 {
f7153f0
     int avail, index, boundary;
f7153f0
 
f7153f0
+    if (s->stop <= s->start) {
f7153f0
+        return 1;
f7153f0
+    }
f7153f0
+
f7153f0
     index = s->curpag << 8;
f7153f0
     boundary = s->boundary << 8;
f7153f0
     if (index < boundary)
f7153f0
-- 
f7153f0
2.5.0