From 7675af55f74c62f5dac6b3fcfae216198b642e61 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 8 Aug 2003 01:39:53 +0000 Subject: use sizeof with strlcpy() when possible; it is less error prone. From Patrick Latifi; ok avsm@ and krw@ --- bin/pax/cache.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'bin/pax') diff --git a/bin/pax/cache.c b/bin/pax/cache.c index 8dc53df6e7c..3508267caa4 100644 --- a/bin/pax/cache.c +++ b/bin/pax/cache.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cache.c,v 1.14 2003/06/02 23:32:08 millert Exp $ */ +/* $OpenBSD: cache.c,v 1.15 2003/08/08 01:39:52 millert Exp $ */ /* $NetBSD: cache.c,v 1.4 1995/03/21 09:07:10 cgd Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static const char sccsid[] = "@(#)cache.c 8.1 (Berkeley) 5/31/93"; #else -static const char rcsid[] = "$OpenBSD: cache.c,v 1.14 2003/06/02 23:32:08 millert Exp $"; +static const char rcsid[] = "$OpenBSD: cache.c,v 1.15 2003/08/08 01:39:52 millert Exp $"; #endif #endif /* not lint */ @@ -226,7 +226,7 @@ name_uid(uid_t uid, int frc) if (ptr == NULL) return(pw->pw_name); ptr->uid = uid; - (void)strlcpy(ptr->name, pw->pw_name, UNMLEN); + (void)strlcpy(ptr->name, pw->pw_name, sizeof(ptr->name)); ptr->valid = VALID; } return(ptr->name); @@ -292,7 +292,7 @@ name_gid(gid_t gid, int frc) if (ptr == NULL) return(gr->gr_name); ptr->gid = gid; - (void)strlcpy(ptr->name, gr->gr_name, GNMLEN); + (void)strlcpy(ptr->name, gr->gr_name, sizeof(ptr->name)); ptr->valid = VALID; } return(ptr->name); @@ -351,7 +351,7 @@ uid_name(char *name, uid_t *uid) *uid = pw->pw_uid; return(0); } - (void)strlcpy(ptr->name, name, UNMLEN); + (void)strlcpy(ptr->name, name, sizeof(ptr->name)); if ((pw = getpwnam(name)) == NULL) { ptr->valid = INVALID; return(-1); @@ -414,7 +414,7 @@ gid_name(char *name, gid_t *gid) return(0); } - (void)strlcpy(ptr->name, name, GNMLEN); + (void)strlcpy(ptr->name, name, sizeof(ptr->name)); if ((gr = getgrnam(name)) == NULL) { ptr->valid = INVALID; return(-1); -- cgit v1.2.3