Blob Blame History Raw
From: Prasad J Pandit <address@hidden>

When receiving packets over MIPSnet network device, it uses
 receive buffer of size 1514 bytes. In case the controller
accepts large(MTU) packets, it could lead to memory corruption.
Add check to avoid it.

Reported by: Oleksandr Bazhaniuk <address@hidden>

Signed-off-by: Prasad J Pandit <address@hidden>
---
 tools/qemu-xen-traditional/hw/mipsnet.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/qemu-xen-traditional/hw/mipsnet.c b/tools/qemu-xen-traditional/hw/mipsnet.c
index f261011..e134b31 100644
--- a/tools/qemu-xen-traditional/hw/mipsnet.c
+++ b/tools/qemu-xen-traditional/hw/mipsnet.c
@@ -82,6 +82,9 @@ static ssize_t mipsnet_receive(NetClientState *nc, const uint8_t *buf, size_t si
     if (!mipsnet_can_receive(opaque))
         return;
 
+    if (size >= sizeof(s->rx_buffer)) {
+        return;
+    }
     s->busy = 1;
 
     /* Just accept everything. */
-- 
2.5.5