net: Truncate recvfrom and sendto length to INT_MAX.
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 30 Oct 2010 23:43:10 +0000 (16:43 -0700)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Sun, 17 Apr 2011 20:15:59 +0000 (16:15 -0400)
commit 253eacc070b114c2ec1f81b067d2fed7305467b0 upstream.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
net/socket.c

index 5e8d0af3c0e73b3537c1852eee2c15a917e4a605..c63ebf4e31b5eee010a30a3d700c4c591482561c 100644 (file)
@@ -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;