Browse Source

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
Johannes Schindelin 5 years ago committed by Junio C Hamano
parent
commit
60e6569a12
  1. 2
      compat/mingw.c

2
compat/mingw.c

@ -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…
Cancel
Save