From: Linus Torvalds Date: Sat, 30 Oct 2010 23:43:10 +0000 (-0700) Subject: net: Truncate recvfrom and sendto length to INT_MAX. X-Git-Tag: v2.6.34.9~84 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9f1dd99a0eb80d2c1e93682c766bcddbdf42f30f;p=thirdparty%2Fkernel%2Fstable.git net: Truncate recvfrom and sendto length to INT_MAX. commit 253eacc070b114c2ec1f81b067d2fed7305467b0 upstream. Signed-off-by: Linus Torvalds Signed-off-by: David S. Miller Signed-off-by: Paul Gortmaker --- diff --git a/net/socket.c b/net/socket.c index 5e8d0af3c0e73..c63ebf4e31b5e 100644 --- a/net/socket.c +++ b/net/socket.c @@ -1672,6 +1672,8 @@ SYSCALL_DEFINE6(sendto, int, fd, void __user *, buff, size_t, len, struct iovec iov; int fput_needed; + if (len > INT_MAX) + len = INT_MAX; sock = sockfd_lookup_light(fd, &err, &fput_needed); if (!sock) goto out; @@ -1729,6 +1731,8 @@ SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size, int err, err2; int fput_needed; + if (size > INT_MAX) + size = INT_MAX; sock = sockfd_lookup_light(fd, &err, &fput_needed); if (!sock) goto out;