mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 14:25:15 +00:00
When checking for a command in the directory, only copy the base dir once.
This commit is contained in:
6
parse.c
6
parse.c
@@ -349,10 +349,12 @@ command_matches(cmnd, cmnd_args, path, sudoers_args)
|
||||
if (dirp == NULL)
|
||||
return(FALSE);
|
||||
|
||||
if (strlcpy(buf, path, sizeof(buf)) >= sizeof(buf))
|
||||
return(FALSE);
|
||||
while ((dent = readdir(dirp)) != NULL) {
|
||||
/* ignore paths > PATH_MAX (XXX - log) */
|
||||
if (strlcpy(buf, path, sizeof(buf)) >= sizeof(buf) ||
|
||||
strlcat(buf, dent->d_name, sizeof(buf)) >= sizeof(buf))
|
||||
buf[plen] = '\0';
|
||||
if (strlcat(buf, dent->d_name, sizeof(buf)) >= sizeof(buf))
|
||||
continue;
|
||||
|
||||
/* only stat if basenames are the same */
|
||||
|
Reference in New Issue
Block a user