提交 90ffefe5 编写于 作者: J Jeff King 提交者: Junio C Hamano

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

The bug was triggered by commit febf7ea4bed from linux-2.6.
Signed-off-by: NJeff King <peff@peff.net>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 62b339a5
......@@ -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--;
}
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册