Kernel: Use copy_n_from_user in sys$setgroups to check for overflow
This commit is contained in:
parent
4743afeaf4
commit
d934e77522
Notes:
sideshowbarker
2024-07-18 22:02:53 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/d934e775227 Pull-request: https://github.com/SerenityOS/serenity/pull/5454
1 changed files with 1 additions and 1 deletions
|
@ -150,7 +150,7 @@ int Process::sys$setgroups(ssize_t count, Userspace<const gid_t*> user_gids)
|
|||
|
||||
Vector<gid_t> gids;
|
||||
gids.resize(count);
|
||||
if (!copy_from_user(gids.data(), user_gids.unsafe_userspace_ptr(), sizeof(gid_t) * count))
|
||||
if (!copy_n_from_user(gids.data(), user_gids, count))
|
||||
return -EFAULT;
|
||||
|
||||
HashTable<gid_t> unique_extra_gids;
|
||||
|
|
Loading…
Add table
Reference in a new issue