From e8d6d478c45cff4a832e958b40c2f8dc32eb6466 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Fri, 30 Apr 2021 01:59:55 -0700 Subject: [PATCH] Kernel: Harden LocalSocket Vector usage against OOM. --- Kernel/Net/LocalSocket.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp index 70ab9d7b3c..5a38760c68 100644 --- a/Kernel/Net/LocalSocket.cpp +++ b/Kernel/Net/LocalSocket.cpp @@ -466,7 +466,8 @@ KResult LocalSocket::sendfd(const FileDescription& socket_description, FileDescr // FIXME: Figure out how we should limit this properly. if (queue.size() > 128) return EBUSY; - queue.append(move(passing_description)); + if (!queue.try_append(move(passing_description))) + return ENOMEM; return KSuccess; }