Make execve(2) require 1 <= argc.

This commit is contained in:
Mathew John Roberts 2022-02-13 16:31:41 +00:00 committed by Juhani Krekelä
parent aa7c6855f7
commit d41beab4a8
1 changed files with 3 additions and 0 deletions

View File

@ -850,6 +850,9 @@ int Process::Execute(const char* programname, const uint8_t* program,
assert(envc != INT_MAX);
assert(CurrentProcess() == this);
if ( argc == 0 )
return errno = EINVAL, -1;
char* programname_clone = String::Clone(programname);
if ( !programname_clone )
return -1;