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 <alexandr.miloslavskiy@syntevo.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Johannes Schindelin 2019-10-25 14:13:36 +00:00 committed by Junio C Hamano
parent 5fa0f5238b
commit 60e6569a12

View file

@ -363,6 +363,8 @@ static inline int needs_hiding(const char *path)
/* ignore trailing slashes */
if (*path)
basename = path;
else
break;
}
if (hide_dotfiles == HIDE_DOTFILES_TRUE)