Skip to content

Commit

Permalink
shortlog: fix segfault on empty authorname
Browse files Browse the repository at this point in the history
The old code looked backwards from the email address to parse
the name, allowing an arbitrary number of spaces between the
two. However, in the case of no name, we looked back too far to
the 'author' (or 'Author:') header.

The bug was triggered by commit febf7ea4bed from linux-2.6.

Jeff King originally fixed it by looking back only one
character; Johannes Schindelin pointed out that we could try
harder while at it to cope with commits with broken headers.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Dec 11, 2006
1 parent bca7325 commit 6f98725
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builtin-shortlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ static void read_from_stdin(struct path_list *list)
bob = buffer + strlen(buffer);
else {
offset = 8;
if (isspace(bob[-1]))
while (buffer + offset < bob &&
isspace(bob[-1]))
bob--;
}

Expand Down

0 comments on commit 6f98725

Please sign in to comment.