1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 19:55:06 +00:00

Kernel: Harden Socket Vector usage against OOM

This commit is contained in:
Brian Gianforcaro 2021-04-30 02:07:44 -07:00 committed by Linus Groh
parent e8d6d478c4
commit f0568bff9b

View file

@ -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;
}