Skip to content

Commit 600682a

Browse files
raalkmlJunio C Hamano
authored andcommitted
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 <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent a07157a commit 600682a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mailmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ int map_email(struct path_list *map, const char *email, char *name, int maxlen)
8080
free(mailbuf);
8181
if (item != NULL) {
8282
const char *realname = (const char *)item->util;
83-
strncpy(name, realname, maxlen);
83+
strlcpy(name, realname, maxlen);
8484
return 1;
8585
}
8686
return 0;

0 commit comments

Comments
 (0)