summaryrefslogtreecommitdiff
path: root/bin/pax
diff options
context:
space:
mode:
Diffstat (limited to 'bin/pax')
-rw-r--r--bin/pax/cache.c16
-rw-r--r--bin/pax/tar.c13
2 files changed, 11 insertions, 18 deletions
diff --git a/bin/pax/cache.c b/bin/pax/cache.c
index 9475638f0c8..36a9280c5f3 100644
--- a/bin/pax/cache.c
+++ b/bin/pax/cache.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cache.c,v 1.8 2001/05/26 00:32:21 millert Exp $ */
+/* $OpenBSD: cache.c,v 1.9 2001/06/26 14:19:33 lebel Exp $ */
/* $NetBSD: cache.c,v 1.4 1995/03/21 09:07:10 cgd Exp $ */
/*-
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)cache.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: cache.c,v 1.8 2001/05/26 00:32:21 millert Exp $";
+static char rcsid[] = "$OpenBSD: cache.c,v 1.9 2001/06/26 14:19:33 lebel Exp $";
#endif
#endif /* not lint */
@@ -257,8 +257,7 @@ name_uid(uid, frc)
if (ptr == NULL)
return(pw->pw_name);
ptr->uid = uid;
- (void)strncpy(ptr->name, pw->pw_name, UNMLEN-1);
- ptr->name[UNMLEN-1] = '\0';
+ (void)strlcpy(ptr->name, pw->pw_name, UNMLEN);
ptr->valid = VALID;
}
return(ptr->name);
@@ -331,8 +330,7 @@ name_gid(gid, frc)
if (ptr == NULL)
return(gr->gr_name);
ptr->gid = gid;
- (void)strncpy(ptr->name, gr->gr_name, GNMLEN-1);
- ptr->name[GNMLEN-1] = '\0';
+ (void)strlcpy(ptr->name, gr->gr_name, GNMLEN);
ptr->valid = VALID;
}
return(ptr->name);
@@ -398,8 +396,7 @@ uid_name(name, uid)
*uid = pw->pw_uid;
return(0);
}
- (void)strncpy(ptr->name, name, UNMLEN-1);
- ptr->name[UNMLEN-1] = '\0';
+ (void)strlcpy(ptr->name, name, UNMLEN);
if ((pw = getpwnam(name)) == NULL) {
ptr->valid = INVALID;
return(-1);
@@ -469,8 +466,7 @@ gid_name(name, gid)
return(0);
}
- (void)strncpy(ptr->name, name, GNMLEN-1);
- ptr->name[GNMLEN-1] = '\0';
+ (void)strlcpy(ptr->name, name, GNMLEN);
if ((gr = getgrnam(name)) == NULL) {
ptr->valid = INVALID;
return(-1);
diff --git a/bin/pax/tar.c b/bin/pax/tar.c
index a576ffd22c2..e088dd36375 100644
--- a/bin/pax/tar.c
+++ b/bin/pax/tar.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tar.c,v 1.18 2001/05/26 00:32:21 millert Exp $ */
+/* $OpenBSD: tar.c,v 1.19 2001/06/26 14:19:33 lebel Exp $ */
/* $NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $ */
/*-
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94";
#else
-static char rcsid[] = "$OpenBSD: tar.c,v 1.18 2001/05/26 00:32:21 millert Exp $";
+static char rcsid[] = "$OpenBSD: tar.c,v 1.19 2001/06/26 14:19:33 lebel Exp $";
#endif
#endif /* not lint */
@@ -1020,8 +1020,7 @@ ustar_wr(arcn)
* occur, we remove the / and copy the first part to the prefix
*/
*pt = '\0';
- strncpy(hd->prefix, arcn->name, sizeof(hd->prefix) - 1);
- hd->prefix[sizeof(hd->prefix) - 1] = '\0';
+ strncpy(hd->prefix, arcn->name, sizeof(hd->prefix));
*pt++ = '/';
} else
memset(hd->prefix, 0, sizeof(hd->prefix));
@@ -1030,8 +1029,7 @@ ustar_wr(arcn)
* copy the name part. this may be the whole path or the part after
* the prefix
*/
- strncpy(hd->name, pt, sizeof(hd->name) - 1);
- hd->name[sizeof(hd->name) - 1] = '\0';
+ strncpy(hd->name, pt, sizeof(hd->name));
/*
* set the fields in the header that are type dependent
@@ -1074,8 +1072,7 @@ ustar_wr(arcn)
hd->typeflag = SYMTYPE;
else
hd->typeflag = LNKTYPE;
- strncpy(hd->linkname,arcn->ln_name, sizeof(hd->linkname) - 1);
- hd->linkname[sizeof(hd->linkname) - 1] = '\0';
+ strncpy(hd->linkname,arcn->ln_name, sizeof(hd->linkname));
memset(hd->devmajor, 0, sizeof(hd->devmajor));
memset(hd->devminor, 0, sizeof(hd->devminor));
if (ul_oct((u_long)0L, hd->size, sizeof(hd->size), 3))