Skip to content

Commit

Permalink
Default to empty environment (#3)
Browse files Browse the repository at this point in the history
* Default to empty environment

* Fix test
  • Loading branch information
ConnorNelson authored Dec 19, 2024
1 parent fa0e0f9 commit e727dba
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion exec-suid.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ int main(int argc, char *argv[], char *envp[])
CHECK_ERRNO(setegid(new_egid));
CHECK_ERRNO(seteuid(new_euid));

CHECK_ERRNO(execve(script_argv[0], script_argv, envp));
CHECK_ERRNO(execve(script_argv[0], script_argv, NULL));

return 0;
}
5 changes: 5 additions & 0 deletions tests/programs/test_python_empty_env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/exec-suid -- /usr/bin/python3 -I

import os

assert os.environ == {}, f"Expected {os.environ} to be {{}}"
1 change: 1 addition & 0 deletions tests/test_programs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
- name: test_python_argv0_relative_path
argv: [./test_python_argv0_relative_path]
cwd: /tests/programs
- name: test_python_empty_env

0 comments on commit e727dba

Please sign in to comment.