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>maint
parent
5fa0f5238b
commit
60e6569a12
|
@ -363,6 +363,8 @@ static inline int needs_hiding(const char *path)
|
||||||
/* ignore trailing slashes */
|
/* ignore trailing slashes */
|
||||||
if (*path)
|
if (*path)
|
||||||
basename = path;
|
basename = path;
|
||||||
|
else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hide_dotfiles == HIDE_DOTFILES_TRUE)
|
if (hide_dotfiles == HIDE_DOTFILES_TRUE)
|
||||||
|
|
Loading…
Reference in New Issue