archive mirror
 help / color / mirror / Atom feed
From: "Johannes Schindelin via GitGitGadget" <>
Cc: Johannes Schindelin <>,
	Junio C Hamano <>,
	Johannes Schindelin <>
Subject: [PATCH 1/1] mingw: avoid a buffer overrun in `needs_hiding()`
Date: Fri, 25 Oct 2019 14:13:36 +0000	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

From: Johannes Schindelin <>

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 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)

      reply	other threads:[~2019-10-25 14:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25 14:13 [PATCH 0/1] mingw: avoid a buffer overrun in needs_hiding() Johannes Schindelin via GitGitGadget
2019-10-25 14:13 ` Johannes Schindelin via GitGitGadget [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).