Skip to content

Commit 0b6a19e

Browse files
dschoSyntevoAlex
andcommitted
mingw: avoid a buffer overrun in needs_hiding()
When this function is passed a path with a trailing slash, it runs right over the end of that path. Let's fix this. Co-authored-by: Alexandr Miloslavskiy <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent b1b9387 commit 0b6a19e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

compat/mingw.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,8 @@ static inline int needs_hiding(const char *path)
591591
/* ignore trailing slashes */
592592
if (*path)
593593
basename = path;
594+
else
595+
break;
594596
}
595597

596598
if (hide_dotfiles == HIDE_DOTFILES_TRUE)

0 commit comments

Comments
 (0)