mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-30 05:48:18 +00:00
Close dir before returning if strlcpy() reports overflow.
From Martynas Venckus.
This commit is contained in:
parent
ee20527bf0
commit
fde79c46fb
4
match.c
4
match.c
@ -580,8 +580,10 @@ command_matches_dir(sudoers_dir, dlen)
|
||||
if (dirp == NULL)
|
||||
return(FALSE);
|
||||
|
||||
if (strlcpy(buf, sudoers_dir, sizeof(buf)) >= sizeof(buf))
|
||||
if (strlcpy(buf, sudoers_dir, sizeof(buf)) >= sizeof(buf)) {
|
||||
closedir(dirp);
|
||||
return(FALSE);
|
||||
}
|
||||
while ((dent = readdir(dirp)) != NULL) {
|
||||
/* ignore paths > PATH_MAX (XXX - log) */
|
||||
buf[dlen] = '\0';
|
||||
|
Loading…
x
Reference in New Issue
Block a user