summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorPrasad J Pandit2016-04-07 12:26:02 +0200
committerJason Wang2016-05-25 09:46:07 +0200
commit3af9187fc6caaf415ab9c0c6d92c9678f65cb17f (patch)
tree25d97e4e95fe277643d573806fa58126768df212 /hw
parentnet/tap: Allocating Large sized arrays to heap (diff)
downloadqemu-3af9187fc6caaf415ab9c0c6d92c9678f65cb17f.tar.gz
qemu-3af9187fc6caaf415ab9c0c6d92c9678f65cb17f.tar.xz
qemu-3af9187fc6caaf415ab9c0c6d92c9678f65cb17f.zip
net: mipsnet: check packet length against buffer
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> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/net/mipsnet.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/net/mipsnet.c b/hw/net/mipsnet.c
index 740cd98ff1..cf8b8236df 100644
--- a/hw/net/mipsnet.c
+++ b/hw/net/mipsnet.c
@@ -83,6 +83,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. */