From 0b6a19e484f24f35327e688ac7297bf99b6b3994 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 25 Oct 2019 10:20:36 +0200 Subject: [PATCH] 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 --- compat/mingw.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compat/mingw.c b/compat/mingw.c index 55891ff83e23cc..617ceb7e646089 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -591,6 +591,8 @@ static inline int needs_hiding(const char *path) /* ignore trailing slashes */ if (*path) basename = path; + else + break; } if (hide_dotfiles == HIDE_DOTFILES_TRUE)