summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-11-11 09:38:44 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-11-11 13:13:08 +0100
commit11fd7aed2a5594405e14b2b58757c61460372b36 (patch)
treed8e0e5cae3131ed07514efd4c4685eca401c6d29 /Kernel
parent0e80b7faa585248f4e68c43c6964a9d162630c33 (diff)
downloadserenity-11fd7aed2a5594405e14b2b58757c61460372b36.zip
Kernel: open() with a zero-length path should fail with EINVAL
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Process.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 35e1b81995..54afa1eadd 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -1348,6 +1348,8 @@ int Process::sys$open(const Syscall::SC_open_params* params)
if (!validate_read_typed(params))
return -EFAULT;
auto& [path, path_length, options, mode] = *params;
+ if (!path_length)
+ return -EINVAL;
if (!validate_read(path, path_length))
return -EFAULT;
#ifdef DEBUG_IO