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