now bail if ARgv[1] > MAXPATHLEN

This commit is contained in:
Todd C. Miller
1994-10-04 16:56:40 +00:00
parent 92245ab4ff
commit 6b069fabe7

7
sudo.c
View File

@@ -586,7 +586,12 @@ static void load_cmnd()
{
char path[MAXPATHLEN + 1];
strncpy(path, Argv[1], MAXPATHLEN)[MAXPATHLEN] = 0;
if (strlen(Argv[1]) >= sizeof(path)) {
(void) fprintf(stderr, "%s: %s: Pathname too long\n", Argv[0], Argv[1]);
exit(1);
}
(void) strcpy(path, Argv[1]);
cmnd = find_path(path); /* get the absolute path */
if (cmnd == NULL) {