Make the behavior of sys_execve be consistent with Linux

This commit is contained in:
Chen Chengjun
2024-07-31 15:36:35 +08:00
committed by Tate, Hongliang Tian
parent b1ea422efa
commit 9a299b68f0

View File

@ -159,6 +159,10 @@ fn read_cstring_vec(
max_string_len: usize,
) -> Result<Vec<CString>> {
let mut res = Vec::new();
// On Linux, argv pointer and envp pointer can be specified as NULL.
if array_ptr == 0 {
return Ok(res);
}
let mut read_addr = array_ptr;
let mut find_null = false;
for _ in 0..max_string_number {