Merge branch 'rf/maint-mailmap-off-by-one' into maint
authorJunio C Hamano <gitster@pobox.com>
Tue, 20 Nov 2012 18:14:28 +0000 (10:14 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 20 Nov 2012 18:14:29 +0000 (10:14 -0800)
* rf/maint-mailmap-off-by-one:
mailmap: avoid out-of-bounds memory access

mailmap.c
index 47aa41924507f7603aab5e35abb51b3956a33dad..ea4b471edeb5ca9b29a8138f6f831a5e6a15a9e8 100644 (file)
--- a/mailmap.c
+++ b/mailmap.c
@@ -118,7 +118,7 @@ static char *parse_name_and_email(char *buffer, char **name,
        while (isspace(*nstart) && nstart < left)
                ++nstart;
        nend = left-1;
-       while (isspace(*nend) && nend > nstart)
+       while (nend > nstart && isspace(*nend))
                --nend;
 
        *name = (nstart < nend ? nstart : NULL);