Skip to content

Commit

Permalink
Use strlcpy instead of strncpy in mailmap.c
Browse files Browse the repository at this point in the history
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 <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Alex Riesen authored and Junio C Hamano committed Apr 30, 2007
1 parent a07157a commit 600682a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mailmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 600682a

Please sign in to comment.