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>
This commit is contained in:
parent
a07157ac62
commit
600682aaa1
@ -80,7 +80,7 @@ int map_email(struct path_list *map, const char *email, char *name, int maxlen)
|
|||||||
free(mailbuf);
|
free(mailbuf);
|
||||||
if (item != NULL) {
|
if (item != NULL) {
|
||||||
const char *realname = (const char *)item->util;
|
const char *realname = (const char *)item->util;
|
||||||
strncpy(name, realname, maxlen);
|
strlcpy(name, realname, maxlen);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user