Git development
 help / color / mirror / Atom feed
* [PATCH] Use strlcpy instead of strncpy in mailmap.c
@ 2007-04-30 22:22 Alex Riesen
  0 siblings, 0 replies; only message in thread
From: Alex Riesen @ 2007-04-30 22:22 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

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>
---
 mailmap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mailmap.c b/mailmap.c
index af187a3..c29e4e5 100644
--- a/mailmap.c
+++ b/mailmap.c
@@ -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;
-- 
1.5.2.rc0.792.g7f4bd0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-04-30 22:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-30 22:22 [PATCH] Use strlcpy instead of strncpy in mailmap.c Alex Riesen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox