mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
Kernel: Harden Socket Vector usage against OOM
This commit is contained in:
parent
e8d6d478c4
commit
f0568bff9b
Notes:
sideshowbarker
2024-07-18 18:50:17 +09:00
Author: https://github.com/bgianfo
Commit: f0568bff9b
Pull-request: https://github.com/SerenityOS/serenity/pull/6756
Reviewed-by: https://github.com/awesomekling
1 changed files with 2 additions and 1 deletions
|
@ -72,7 +72,8 @@ KResult Socket::queue_connection_from(NonnullRefPtr<Socket> peer)
|
|||
Locker locker(m_lock);
|
||||
if (m_pending.size() >= m_backlog)
|
||||
return ECONNREFUSED;
|
||||
m_pending.append(peer);
|
||||
if (!m_pending.try_append(peer))
|
||||
return ENOMEM;
|
||||
evaluate_block_conditions();
|
||||
return KSuccess;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue