@matheusbsbs / matheus-bagliano / commits / 60e6569a12
Fork 0

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>

Johannes Schindelin committed Oct 25, 2019 at 14:13 UTC 60e6569a1207d75a351684e2c48f8d18d15a0032
1 file changed +2
compat/mingw.c
+2
@@ -363,6 +363,8 @@ static inline int needs_hiding(const char *path)
363 /* ignore trailing slashes */
364 if (*path)
365 basename = path;
366 + else
367 + break;
368 }
369
370 if (hide_dotfiles == HIDE_DOTFILES_TRUE)