2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 14:25:15 +00:00

Don't assume argv[0] is set without first checking argc.

This commit is contained in:
Todd C. Miller
2015-02-05 11:17:25 -07:00
parent b727d4309c
commit 67eba7e534
2 changed files with 5 additions and 3 deletions

View File

@@ -379,8 +379,10 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv,
}
env_add[nenv] = NULL;
argc -= optind;
argv += optind;
if (argc > 0) {
argc -= optind;
argv += optind;
}
if (!mode) {
/* Defer -k mode setting until we know whether it is a flag or not */