Close dir before returning if strlcpy() reports overflow.
From Martynas Venckus.
This commit is contained in:
4
match.c
4
match.c
@@ -580,8 +580,10 @@ command_matches_dir(sudoers_dir, dlen)
|
|||||||
if (dirp == NULL)
|
if (dirp == NULL)
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
|
||||||
if (strlcpy(buf, sudoers_dir, sizeof(buf)) >= sizeof(buf))
|
if (strlcpy(buf, sudoers_dir, sizeof(buf)) >= sizeof(buf)) {
|
||||||
|
closedir(dirp);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
}
|
||||||
while ((dent = readdir(dirp)) != NULL) {
|
while ((dent = readdir(dirp)) != NULL) {
|
||||||
/* ignore paths > PATH_MAX (XXX - log) */
|
/* ignore paths > PATH_MAX (XXX - log) */
|
||||||
buf[dlen] = '\0';
|
buf[dlen] = '\0';
|
||||||
|
Reference in New Issue
Block a user