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

[PATCH] fmt-merge-msg: fix off-by-one bug

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Sep 1, 2006, 08:49 UTC
Message-ID
<Pine.LNX.4.63.0609011048590.28360@wbgn013.biozentrum.uni-wuerzburg.de>

Thanks to the recent malloc()->xmalloc() change, and XMALLOC_POISON, this bug was found.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 builtin-fmt-merge-msg.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin-fmt-merge-msg.c b/builtin-fmt-merge-msg.c
index ed59e77..432963d 100644
--- a/builtin-fmt-merge-msg.c
+++ b/builtin-fmt-merge-msg.c
@@ -142,7 +142,7 @@ static int handle_line(char *line)
 		if (origin[0] == '\'' && origin[len - 1] == '\'') {
 			char *new_origin = xmalloc(len - 1);
 			memcpy(new_origin, origin + 1, len - 2);
-			new_origin[len - 1] = 0;
+			new_origin[len - 2] = 0;
 			origin = new_origin;
 		} else
 			origin = strdup(origin);
-- 
1.4.2.gc2fc-dirty
Message 1 of 1 in “fmt-merge-msg: fix off-by-one bug”
  1. fmt-merge-msg: fix off-by-one bugJohannes Schindelin, Sep 1, 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.