summaryrefslogtreecommitdiff
path: root/Kernel/Net
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-02-13 01:29:28 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-13 01:29:28 +0100
commitaf0e52ca54959dc509c12343c7998f50082623f7 (patch)
tree6e235e387af3678322093b367690ed6a9085c37f /Kernel/Net
parenta5def4e98cae47e13022e9d1461eba84520b972f (diff)
downloadserenity-af0e52ca54959dc509c12343c7998f50082623f7.zip
Kernel: Don't assert on sys$setsockopt() with unexpected level
Just error out with ENOPROTOOPT instead. Found by fuzz-syscalls. :^)
Diffstat (limited to 'Kernel/Net')
-rw-r--r--Kernel/Net/Socket.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Kernel/Net/Socket.cpp b/Kernel/Net/Socket.cpp
index dd581fe84f..9456a48807 100644
--- a/Kernel/Net/Socket.cpp
+++ b/Kernel/Net/Socket.cpp
@@ -99,6 +99,8 @@ KResult Socket::queue_connection_from(NonnullRefPtr<Socket> peer)
KResult Socket::setsockopt(int level, int option, Userspace<const void*> user_value, socklen_t user_value_size)
{
+ if (level != SOL_SOCKET)
+ return ENOPROTOOPT;
ASSERT(level == SOL_SOCKET);
switch (option) {
case SO_SNDTIMEO: