fmt-merge-msg: fix off-by-one bug
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Fri, 1 Sep 2006 08:49:29 +0000 (10:49 +0200)
committerJunio C Hamano <junkio@cox.net>
Fri, 1 Sep 2006 12:20:03 +0000 (05:20 -0700)
Thanks to the recent malloc()->xmalloc() change, and XMALLOC_POISON, this bug
was found.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-fmt-merge-msg.c

index ed59e77e1923ee8f0df050dd6851b805a26127a2..432963db9006c404d4b79c7e9b5c8d539e783605 100644 (file)
@@ -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);