git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[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
Previous: Johannes Schindelin via GitGitGadget
Message 2 of 2 in “mingw: avoid a buffer overrun in needs_hiding()”
  1. 0/1 mingw: avoid a buffer overrun in needs_hiding()Johannes Schindelin via GitGitGadget, Oct 25, 2019
  2. 1/1 mingw: avoid a buffer overrun in `needs_hiding()`Johannes Schindelin via GitGitGadget, Oct 25, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.