From 9b01f0038b63ccdf697b2387f4fcd4b03bd249d5 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 21 Apr 2011 15:07:36 -0700 Subject: blame: tolerate bogus e-mail addresses a bit better The names and e-mails are sanitized by fmt_ident() when creating commits, so that they do not contain "<" nor ">", and the "committer" and "author" lines in the commit object will always be in the form: ("author" | "committer") name SP "<" email ">" SP timestamp SP zone When parsing the email part out, the current code looks for SP starting from the end of the email part, but the author could obfuscate the address as "author at example dot com". We should instead look for SP followed by "<", to match the logic of the side that formats these lines. Signed-off-by: Josh Stone Reviewed-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/blame.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin/blame.c') diff --git a/builtin/blame.c b/builtin/blame.c index f6b03f750a..41525f1ea1 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -1377,7 +1377,7 @@ static void get_ac_line(const char *inbuf, const char *what, timepos = tmp; *tmp = 0; - while (person < tmp && *tmp != ' ') + while (person < tmp && !(*tmp == ' ' && tmp[1] == '<')) tmp--; if (tmp <= person) return; -- cgit v1.2.3