Skip to content

Commit 3d29a08

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 331fef4 commit 3d29a08

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
@@ -363,6 +363,8 @@ static inline int needs_hiding(const char *path)
363363
/* ignore trailing slashes */
364364
if (*path)
365365
basename = path;
366+
else
367+
break;
366368
}
367369

368370
if (hide_dotfiles == HIDE_DOTFILES_TRUE)

0 commit comments

Comments
 (0)