mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 11:42:38 +03:00
Kernel: Harden sys$readv / sys$writev Vector usage against OOM.
This commit is contained in:
parent
cd29eb7867
commit
454d2fd42a
Notes:
sideshowbarker
2024-07-18 18:54:11 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/454d2fd42a5 Pull-request: https://github.com/SerenityOS/serenity/pull/6733
@ -24,7 +24,8 @@ KResultOr<ssize_t> Process::sys$readv(int fd, Userspace<const struct iovec*> iov
|
||||
|
||||
u64 total_length = 0;
|
||||
Vector<iovec, 32> vecs;
|
||||
vecs.resize(iov_count);
|
||||
if (!vecs.try_resize(iov_count))
|
||||
return ENOMEM;
|
||||
if (!copy_n_from_user(vecs.data(), iov, iov_count))
|
||||
return EFAULT;
|
||||
for (auto& vec : vecs) {
|
||||
|
@ -23,7 +23,8 @@ KResultOr<ssize_t> Process::sys$writev(int fd, Userspace<const struct iovec*> io
|
||||
|
||||
u64 total_length = 0;
|
||||
Vector<iovec, 32> vecs;
|
||||
vecs.resize(iov_count);
|
||||
if (!vecs.try_resize(iov_count))
|
||||
return ENOMEM;
|
||||
if (!copy_n_from_user(vecs.data(), iov, iov_count))
|
||||
return EFAULT;
|
||||
for (auto& vec : vecs) {
|
||||
|
Loading…
Reference in New Issue
Block a user