From 11fd7aed2a5594405e14b2b58757c61460372b36 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 11 Nov 2019 09:38:44 +0100 Subject: [PATCH] Kernel: open() with a zero-length path should fail with EINVAL --- Kernel/Process.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 35e1b81995a..54afa1eadd2 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