Skip to content

Commit

Permalink
fmt-merge-msg: fix off-by-one bug
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dscho authored and Junio C Hamano committed Sep 1, 2006
1 parent 8c02eee commit af04b12
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin-fmt-merge-msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit af04b12

Please sign in to comment.