From bfbd0bb6ecbbbf75a5caaff6afaf5a6af8fa518e Mon Sep 17 00:00:00 2001 From: Peter Eriksen Date: Sun, 11 Jun 2006 14:03:28 +0200 Subject: Implement safe_strncpy() as strlcpy() and use it more. Signed-off-by: Peter Eriksen Signed-off-by: Junio C Hamano --- builtin-tar-tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'builtin-tar-tree.c') diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c index 58a8ccd4d6..f6310b9032 100644 --- a/builtin-tar-tree.c +++ b/builtin-tar-tree.c @@ -240,8 +240,8 @@ static void write_entry(const unsigned char *sha1, struct strbuf *path, /* XXX: should we provide more meaningful info here? */ sprintf(header.uid, "%07o", 0); sprintf(header.gid, "%07o", 0); - strncpy(header.uname, "git", 31); - strncpy(header.gname, "git", 31); + safe_strncpy(header.uname, "git", sizeof(header.uname)); + safe_strncpy(header.gname, "git", sizeof(header.gname)); sprintf(header.devmajor, "%07o", 0); sprintf(header.devminor, "%07o", 0); -- cgit v1.2.3