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.
Instead, remove at most one space between name and address.

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

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

Expand Down Expand Up @@ -236,7 +236,7 @@ static void get_from_rev(struct rev_info *rev, struct path_list *list)
author = scratch;
authorlen = strlen(scratch);
} else {
while (bracket[-1] == ' ')
if (bracket[-1] == ' ')
bracket--;

author = buffer + 7;
Expand Down

0 comments on commit 90ffefe

Please sign in to comment.