qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] net: mipsnet: check packet length against buffer
@ 2016-04-07 10:26 P J P
  2016-04-07 15:44 ` Markus Armbruster
  2016-04-26  7:16 ` Jason Wang
  0 siblings, 2 replies; 6+ messages in thread
From: P J P @ 2016-04-07 10:26 UTC (permalink / raw)
  To: Qemu Developers; +Cc: Oleksandr Bazhaniuk, Jason Wang, Prasad J Pandit

From: Prasad J Pandit <pjp@fedoraproject.org>

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 <oleksandr.bazhaniuk@intel.com>

Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
 hw/net/mipsnet.c | 3 +++
 1 file changed, 3 insertions(+)

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-04-26  7:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-07 10:26 [Qemu-devel] [PATCH] net: mipsnet: check packet length against buffer P J P
2016-04-07 15:44 ` Markus Armbruster
2016-04-11  7:37   ` P J P
2016-04-11  8:27     ` Jason Wang
2016-04-11  8:51       ` P J P
2016-04-26  7:16 ` Jason Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).