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>
Alex Riesen committed
May 1, 2007 at 00:22 UTC
600682aaa12c56d55bd24233828205c43ece2ded
1 file changed
+1
-1
mailmap.c
+1
-1
@@ -80,7 +80,7 @@ int map_email(struct path_list *map, const char *email, char *name, int maxlen)
80
free(mailbuf);
81
if (item != NULL) {
82
const char *realname = (const char *)item->util;
83
- strncpy(name, realname, maxlen);
83
+ strlcpy(name, realname, maxlen);
84
return 1;
85
}
86
return 0;