mailmap: replace strcpy with xstrdup

We want to make a copy of a string without any leading whitespace. To do so, we allocate a buffer large enough to hold the original, skip past the whitespace, then copy that. It's much simpler to just allocate after we've skipped, in which case we can just copy the remainder of the string, leaving no question of whether "len" is large enough. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Sep 24, 2015 at 17:07 UTC c978610dc841efe300bf4d1ee61b24d78b13c4f4
1 file changed +1 -2
mailmap.c
+1 -2
@@ -162,11 +162,10 @@ static void read_mailmap_line(struct string_list *map, char *buffer,
162 char *cp;
163
164 free(*repo_abbrev);
165 - *repo_abbrev = xmalloc(len);
165
166 for (cp = buffer + abblen; isspace(*cp); cp++)
167 ; /* nothing */
169 - strcpy(*repo_abbrev, cp);
168 + *repo_abbrev = xstrdup(cp);
169 }
170 return;
171 }