su: do not pass out-of-bounds argv to execv when argc is 1
This commit is contained in:
parent
d1e4bc5504
commit
a9da58421f
@ -82,7 +82,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
char* default_argv[] = {user->pw_shell, NULL};
|
char* default_argv[] = {user->pw_shell, NULL};
|
||||||
|
|
||||||
if (argc == 2) run_program(default_argv);
|
if (argc < 3) run_program(default_argv);
|
||||||
else
|
else
|
||||||
run_program(argv + 2);
|
run_program(argv + 2);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user