From: Johannes Schindelin Date: Fri, 25 Oct 2019 14:13:36 +0000 (+0000) Subject: mingw: avoid a buffer overrun in `needs_hiding()` X-Git-Tag: v2.24.0-rc2~3^2 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fgit.git;a=commitdiff_plain;h=60e6569a1207d75a351684e2c48f8d18d15a0032 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 Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- diff --git a/compat/mingw.c b/compat/mingw.c index 738f0a826a..f76ba3d750 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -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)