su: do not pass out-of-bounds argv to execv when argc is 1

This commit is contained in:
apio 2022-10-29 20:13:40 +02:00
parent d1e4bc5504
commit a9da58421f

View File

@ -82,7 +82,7 @@ int main(int argc, char** argv)
char* default_argv[] = {user->pw_shell, NULL};
if (argc == 2) run_program(default_argv);
if (argc < 3) run_program(default_argv);
else
run_program(argv + 2);
}