Skip to content

Commit

Permalink
net: ignore packet size greater than INT_MAX
Browse files Browse the repository at this point in the history
There should not be a reason for passing a packet size greater than
INT_MAX. It's usually a hint of bug somewhere, so ignore packet size
greater than INT_MAX in qemu_deliver_packet_iov()

CC: qemu-stable@nongnu.org
Reported-by: Daniel Shapira <daniel@twistlock.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit 1592a99)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
  • Loading branch information
jasowang authored and mdroth committed Mar 27, 2019
1 parent 9d9430b commit 901d84e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/net.c
Expand Up @@ -712,10 +712,15 @@ ssize_t qemu_deliver_packet_iov(NetClientState *sender,
void *opaque)
{
NetClientState *nc = opaque;
size_t size = iov_size(iov, iovcnt);
int ret;

if (size > INT_MAX) {
return size;
}

if (nc->link_down) {
return iov_size(iov, iovcnt);
return size;
}

if (nc->receive_disabled) {
Expand Down

0 comments on commit 901d84e

Please sign in to comment.