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

[PATCH 1/3] shortlog: do not crash on parsing "[PATCH"

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Nov 19, 2006, 16:28 UTC
Message-ID
<Pine.LNX.4.63.0611191727560.13772@wbgn013.biozentrum.uni-wuerzburg.de>

Annoyingly, it looked for the closing bracket in the author name instead of in the message, and then accessed the NULL pointer.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 builtin-shortlog.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index 48a2a0b..26212b0 100644
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
@@ -108,13 +108,15 @@ static void insert_author_oneline(struct
 		free(buffer);
 
 	if (!strncmp(oneline, "[PATCH", 6)) {
-		char *eob = strchr(buffer, ']');
-
-		while (isspace(eob[1]) && eob[1] != '\n')
-			eob++;
-		if (eob - oneline < onelinelen) {
-			onelinelen -= eob - oneline;
-			oneline = eob;
+		char *eob = strchr(oneline, ']');
+
+		if (eob) {
+			while (isspace(eob[1]) && eob[1] != '\n')
+				eob++;
+			if (eob - oneline < onelinelen) {
+				onelinelen -= eob - oneline;
+				oneline = eob;
+			}
 		}
 	}
 
-- 
1.4.4.GIT
Message 1 of 1 in “shortlog: do not crash on parsing "[PATCH"”
  1. 1/3 shortlog: do not crash on parsing "[PATCH"Johannes Schindelin, Nov 19, 2006

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.