mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
Kernel: Harden Process Vector usage against OOM.
This commit is contained in:
parent
ee84b8a845
commit
2ee1731966
Notes:
sideshowbarker
2024-07-18 18:50:05 +09:00
Author: https://github.com/bgianfo
Commit: 2ee1731966
Pull-request: https://github.com/SerenityOS/serenity/pull/6756
Reviewed-by: https://github.com/awesomekling
1 changed files with 4 additions and 1 deletions
|
@ -146,7 +146,10 @@ RefPtr<Process> Process::create_user_process(RefPtr<Thread>& first_thread, const
|
|||
auto process = adopt_ref(*new Process(first_thread, parts.take_last(), uid, gid, parent_pid, false, move(cwd), nullptr, tty));
|
||||
if (!first_thread)
|
||||
return {};
|
||||
process->m_fds.resize(m_max_open_file_descriptors);
|
||||
if (!process->m_fds.try_resize(m_max_open_file_descriptors)) {
|
||||
first_thread = nullptr;
|
||||
return {};
|
||||
}
|
||||
auto& device_to_use_as_tty = tty ? (CharacterDevice&)*tty : NullDevice::the();
|
||||
auto description = device_to_use_as_tty.open(O_RDWR).value();
|
||||
process->m_fds[0].set(*description);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue