mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
Kernel: Process::exec(): Check if path is a regular file
https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html [EACCES] The new process image file is not a regular file and the implementation does not support execution of files of its type. Let's check whether the passed `path` is indeed a regular file.
This commit is contained in:
parent
9510425845
commit
f6d372b2ab
Notes:
sideshowbarker
2024-07-18 16:52:25 +09:00
Author: https://github.com/gmta Commit: https://github.com/SerenityOS/serenity/commit/f6d372b2ab0 Pull-request: https://github.com/SerenityOS/serenity/pull/7793
|
@ -827,6 +827,9 @@ KResult Process::exec(String path, Vector<String> arguments, Vector<String> envi
|
|||
auto description = file_or_error.release_value();
|
||||
auto metadata = description->metadata();
|
||||
|
||||
if (!metadata.is_regular_file())
|
||||
return EACCES;
|
||||
|
||||
// Always gonna need at least 3 bytes. these are for #!X
|
||||
if (metadata.size < 3)
|
||||
return ENOEXEC;
|
||||
|
|
Loading…
Reference in a new issue