1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-13 19:16:28 +02:00

shortlog: fix segfault on empty authorname

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>
This commit is contained in:
Junio C Hamano 2006-12-10 15:51:54 -08:00
parent bca73251da
commit 6f98725822

View File

@ -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--;
}