mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 22:15:06 +00:00
Kernel: Harden Process Vector usage against OOM.
This commit is contained in:
parent
ee84b8a845
commit
2ee1731966
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