{"thread":{"id":"7908","subject":"[PATCH] Use strlcpy instead of strncpy in mailmap.c","startedAt":"2007-04-30T22:22:53Z","lastAt":"2007-04-30T22:22:53Z","messageCount":1,"participants":["Alex Riesen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"40762","messageId":"20070430222253.GA5000@steel.home","threadId":"7908","inReplyTo":null,"subject":"[PATCH] Use strlcpy instead of strncpy in mailmap.c","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-04-30T22:22:53Z","receivedAt":"2007-04-30T22:22:53Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"strncpy does not NUL-terminate output in case of output buffer too short,\nand map_email prototype (and usage) does not allow for figuring out\nwhat the length of the name is.\n\nSigned-off-by: Alex Riesen <raa.lkml@gmail.com>\n---\n mailmap.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/mailmap.c b/mailmap.c\nindex af187a3..c29e4e5 100644\n--- a/mailmap.c\n+++ b/mailmap.c\n@@ -80,7 +80,7 @@ int map_email(struct path_list *map, const char *email, char *name, int maxlen)\n \t\tfree(mailbuf);\n \tif (item != NULL) {\n \t\tconst char *realname = (const char *)item->util;\n-\t\tstrncpy(name, realname, maxlen);\n+\t\tstrlcpy(name, realname, maxlen);\n \t\treturn 1;\n \t}\n \treturn 0;\n-- \n1.5.2.rc0.792.g7f4bd0\n"}]}