Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-12-11 02:51:54 +0300
committerJunio C Hamano <junkio@cox.net>2006-12-12 01:12:33 +0300
commit6f9872582246b9b8ee4bdc9f6a563b409aab1ecb (patch)
tree682423816c502753915b167166f14855d6363a24 /builtin-shortlog.c
parentbca73251da5cc3e4bea71e28e0096a5cd662bbd9 (diff)
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>
Diffstat (limited to 'builtin-shortlog.c')
-rw-r--r--builtin-shortlog.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index 3322c3a2ee..3fc43dd7dd 100644
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
@@ -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--;
}