Commit 1592a994 authored by Jason Wang's avatar Jason Wang
Browse files

net: ignore packet size greater than INT_MAX



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: default avatarDaniel Shapira <daniel@twistlock.com>
Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
parent b1d80d12
......@@ -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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment