summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-09-24 21:07:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-09-25 17:18:18 (GMT)
commitc978610dc841efe300bf4d1ee61b24d78b13c4f4 (patch)
tree1e55bd182f0ea0797bdb1d1fce5ba58a704e1e64
parentacd47eec992160d76d5d4a2e98940de3fdc10552 (diff)
downloadgit-c978610dc841efe300bf4d1ee61b24d78b13c4f4.zip
git-c978610dc841efe300bf4d1ee61b24d78b13c4f4.tar.gz
git-c978610dc841efe300bf4d1ee61b24d78b13c4f4.tar.bz2
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>
-rw-r--r--mailmap.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/mailmap.c b/mailmap.c
index 9e95897..f4a0f1c 100644
--- a/mailmap.c
+++ b/mailmap.c
@@ -162,11 +162,10 @@ static void read_mailmap_line(struct string_list *map, char *buffer,
char *cp;
free(*repo_abbrev);
- *repo_abbrev = xmalloc(len);
for (cp = buffer + abblen; isspace(*cp); cp++)
; /* nothing */
- strcpy(*repo_abbrev, cp);
+ *repo_abbrev = xstrdup(cp);
}
return;
}