From: Todd C. Miller Date: Fri, 5 Aug 1994 20:12:09 +0000 (+0000) Subject: made command (and therefor cmnd dynamically allocated) X-Git-Tag: SUDO_1_3_1~60 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=494d1c1168940f847278b6ae4eb983c8fcbdf942;p=sudo made command (and therefor cmnd dynamically allocated) --- diff --git a/find_path.c b/find_path.c index 017ef2a42..80836e5b3 100644 --- a/find_path.c +++ b/find_path.c @@ -97,7 +97,7 @@ char *find_path(file) char *path = NULL; /* contents of PATH env var */ char *oldpath; /* so we can free path later */ char *result = NULL; /* result of path/file lookup */ - static char command[MAXPATHLEN+1]; /* resolved pathname */ + char *command; /* resolved pathname */ int checkdot = 0; /* check current dir? */ if (strlen(file) > MAXPATHLEN) { @@ -105,6 +105,16 @@ char *find_path(file) exit(1); } + /* + * allocate memory for command + */ + command = (char *) malloc(MAXPATHLEN + 1); + if (command == NULL) { + perror("malloc"); + (void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); + exit(1); + } + /* * do we need to search the path? */