Skip to content

Commit

Permalink
net: validate the range we feed to iov_iter_init() in sys_sendto/sys_…
Browse files Browse the repository at this point in the history
…recvfrom

Cc: [email protected] # v3.19
Signed-off-by: Al Viro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Al Viro authored and davem330 committed Mar 20, 2015
1 parent 91edd09 commit 4de930e
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 @@ -1702,6 +1702,8 @@ SYSCALL_DEFINE6(sendto, int, fd, void __user *, buff, size_t, len,

if (len > INT_MAX)
len = INT_MAX;
if (unlikely(!access_ok(VERIFY_READ, buff, len)))
return -EFAULT;
sock = sockfd_lookup_light(fd, &err, &fput_needed);
if (!sock)
goto out;
Expand Down Expand Up @@ -1760,6 +1762,8 @@ SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size,

if (size > INT_MAX)
size = INT_MAX;
if (unlikely(!access_ok(VERIFY_WRITE, ubuf, size)))
return -EFAULT;
sock = sockfd_lookup_light(fd, &err, &fput_needed);
if (!sock)
goto out;
Expand Down

0 comments on commit 4de930e

Please sign in to comment.