History

net: validate the range we feed to iov_iter_init() in sys_sendto/sys_recvfrom

Al Viro committed 11 years ago

Commit 4de930e1 parent 91edd091 file · +4 −0Browse files

Unified · Split

net/socket.c+4−0
@@ -1702,6 +1702,8 @@ SYSCALL_DEFINE6(sendto, int, fd, void __user *, buff, size_t, len, · 1701 unmodified lines
17021702
17031703 if (len > INT_MAX)
17041704 len = INT_MAX;
1705+ if (unlikely(!access_ok(VERIFY_READ, buff, len)))
1706+ return -EFAULT;
17051707 sock = sockfd_lookup_light(fd, &err, &fput_needed);
17061708 if (!sock)
17071709 goto out;
@@ -1760,6 +1762,8 @@ SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size, · 52 unmodified lines
17601762
17611763 if (size > INT_MAX)
17621764 size = INT_MAX;
1765+ if (unlikely(!access_ok(VERIFY_WRITE, ubuf, size)))
1766+ return -EFAULT;
17631767 sock = sockfd_lookup_light(fd, &err, &fput_needed);
17641768 if (!sock)
17651769 goto out;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t