Skip to content

Commit

Permalink
net: Truncate recvfrom and sendto length to INT_MAX.
Browse files Browse the repository at this point in the history
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
torvalds authored and davem330 committed Oct 30, 2010
1 parent d139ff0 commit 253eacc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 253eacc

Please sign in to comment.