From: Alex Riesen Date: Mon, 30 Apr 2007 22:22:53 +0000 (+0200) Subject: Use strlcpy instead of strncpy in mailmap.c X-Git-Tag: v1.5.2-rc1~5 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=600682aaa12c56d55bd24233828205c43ece2ded;p=git.git Use strlcpy instead of strncpy in mailmap.c strncpy does not NUL-terminate output in case of output buffer too short, and map_email prototype (and usage) does not allow for figuring out what the length of the name is. Signed-off-by: Alex Riesen Signed-off-by: Junio C Hamano --- diff --git a/mailmap.c b/mailmap.c index af187a382..c29e4e534 100644 --- a/mailmap.c +++ b/mailmap.c @@ -80,7 +80,7 @@ int map_email(struct path_list *map, const char *email, char *name, int maxlen) free(mailbuf); if (item != NULL) { const char *realname = (const char *)item->util; - strncpy(name, realname, maxlen); + strlcpy(name, realname, maxlen); return 1; } return 0;