mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel: Harden sys$sendmsg / sys$recvmsg Vector usage against OOM.
This commit is contained in:
parent
6288ae2c37
commit
cd29eb7867
Notes:
sideshowbarker
2024-07-18 18:54:15 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/cd29eb7867c Pull-request: https://github.com/SerenityOS/serenity/pull/6733
1 changed files with 4 additions and 2 deletions
|
@ -178,7 +178,8 @@ KResultOr<ssize_t> Process::sys$sendmsg(int sockfd, Userspace<const struct msghd
|
|||
if (msg.msg_iovlen != 1)
|
||||
return ENOTSUP; // FIXME: Support this :)
|
||||
Vector<iovec, 1> iovs;
|
||||
iovs.resize(msg.msg_iovlen);
|
||||
if (!iovs.try_resize(msg.msg_iovlen))
|
||||
return ENOMEM;
|
||||
if (!copy_n_from_user(iovs.data(), msg.msg_iov, msg.msg_iovlen))
|
||||
return EFAULT;
|
||||
|
||||
|
@ -213,7 +214,8 @@ KResultOr<ssize_t> Process::sys$recvmsg(int sockfd, Userspace<struct msghdr*> us
|
|||
if (msg.msg_iovlen != 1)
|
||||
return ENOTSUP; // FIXME: Support this :)
|
||||
Vector<iovec, 1> iovs;
|
||||
iovs.resize(msg.msg_iovlen);
|
||||
if (!iovs.try_resize(msg.msg_iovlen))
|
||||
return ENOMEM;
|
||||
if (!copy_n_from_user(iovs.data(), msg.msg_iov, msg.msg_iovlen))
|
||||
return EFAULT;
|
||||
|
||||
|
|
Loading…
Reference in a new issue