summaryrefslogtreecommitdiff
path: root/net/socket.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-30 16:43:10 -0700
committerDavid S. Miller <davem@davemloft.net>2010-10-30 16:44:07 -0700
commit253eacc070b114c2ec1f81b067d2fed7305467b0 (patch)
treecf55d167c9a1a3fac2b7796f046674a53fbf47b0 /net/socket.c
parentd139ff0907dac9ef72fb2cf301e345bac3aec42f (diff)
downloadlwn-253eacc070b114c2ec1f81b067d2fed7305467b0.tar.gz
lwn-253eacc070b114c2ec1f81b067d2fed7305467b0.zip
net: Truncate recvfrom and sendto length to INT_MAX.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c
index abf3e2561521..2808b4db46ee 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1652,6 +1652,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;
@@ -1709,6 +1711,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;