f3149d8
From: Prasad J Pandit <address@hidden>
f3149d8
f3149d8
When receiving packets over MIPSnet network device, it uses
f3149d8
 receive buffer of size 1514 bytes. In case the controller
f3149d8
accepts large(MTU) packets, it could lead to memory corruption.
f3149d8
Add check to avoid it.
f3149d8
f3149d8
Reported by: Oleksandr Bazhaniuk <address@hidden>
f3149d8
f3149d8
Signed-off-by: Prasad J Pandit <address@hidden>
f3149d8
---
f3149d8
 tools/qemu-xen-traditional/hw/mipsnet.c | 3 +++
f3149d8
 1 file changed, 3 insertions(+)
f3149d8
f3149d8
diff --git a/tools/qemu-xen-traditional/hw/mipsnet.c b/tools/qemu-xen-traditional/hw/mipsnet.c
f3149d8
index f261011..e134b31 100644
f3149d8
--- a/tools/qemu-xen-traditional/hw/mipsnet.c
f3149d8
+++ b/tools/qemu-xen-traditional/hw/mipsnet.c
f3149d8
@@ -82,6 +82,9 @@ static ssize_t mipsnet_receive(NetClientState *nc, const uint8_t *buf, size_t si
f3149d8
     if (!mipsnet_can_receive(opaque))
f3149d8
         return;
f3149d8
 
f3149d8
+    if (size >= sizeof(s->rx_buffer)) {
f3149d8
+        return;
f3149d8
+    }
f3149d8
     s->busy = 1;
f3149d8
 
f3149d8
     /* Just accept everything. */
f3149d8
-- 
f3149d8
2.5.5
f3149d8