path: root/mailmap.c
diff options
authorJunio C Hamano <>2013-07-15 06:54:06 (GMT)
committerJunio C Hamano <>2013-07-15 15:16:00 (GMT)
commit8c3811510e2a90f765edbb6dc7f81b0737592c0a (patch)
tree1a77ecc81df37bf6d234df5795eebdbe841381b4 /mailmap.c
parent109025b4e1c836fb62752f69f24e8f11403760d5 (diff)
mailmap: do not lose single-letter names
In parse_name_and_email() function, there is this line: *name = (nstart < nend ? nstart : NULL); When the function is given a buffer "A <> <old@x.z>", nstart scans from the beginning of the buffer, skipping whitespaces (there isn't any, so nstart points at the buffer), while nend starts from one byte before the first '<' and skips whitespaces backwards and stops at the first non-whitespace (i.e. it hits "A" at the beginning of the buffer). nstart == nend in this case for a single-letter name, and an off-by-one error makes it fail to pick up the name, which makes the entry equivalent to <> <old@x.z> without the name. Signed-off-by: Junio C Hamano <> Signed-off-by: Eric Sunshine <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'mailmap.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/mailmap.c b/mailmap.c
index 2a7b366..418081e 100644
--- a/mailmap.c
+++ b/mailmap.c
@@ -122,7 +122,7 @@ static char *parse_name_and_email(char *buffer, char **name,
while (nend > nstart && isspace(*nend))
- *name = (nstart < nend ? nstart : NULL);
+ *name = (nstart <= nend ? nstart : NULL);
*email = left+1;
*(nend+1) = '\0';
*right++ = '\0';