[PATCH 1/1] mingw: avoid a buffer overrun in `needs_hiding()`
- From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Oct 25, 2019, 14:13 UTC
- Message-ID
- <aaf7bfc54572c6a3cd00eb2034c07a7bf57835fe.1572012816.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.427.git.1572012816.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>
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> --- compat/mingw.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/compat/mingw.c b/compat/mingw.c index 6b765d936c..fe609239dd 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)
-- gitgitgadget