aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-06-25 00:34:52 +0000
committerRob Landley <rob@landley.net>2006-06-25 00:34:52 +0000
commit768945b762b8850691acd2b63116eed18faa1812 (patch)
tree7b443f4d614e327205a5aa17f2c0371c2a04723e /archival
parent641c3537c0bf63793a6195108a1d2e682ed4cba1 (diff)
downloadbusybox-768945b762b8850691acd2b63116eed18faa1812.tar.gz
A few patches from Erik Hovland, turning strncpy() into safe_strncpy() and
removing some unnecessary code.
Diffstat (limited to 'archival')
-rw-r--r--archival/tar.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/archival/tar.c b/archival/tar.c
index f3594f685..5b7c1425a 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -42,12 +42,8 @@
#ifdef CONFIG_FEATURE_TAR_CREATE
/* Tar file constants */
-# define TAR_MAGIC "ustar" /* ustar and a null */
-# define TAR_VERSION " " /* Be compatible with GNU tar format */
#define TAR_BLOCK_SIZE 512
-#define TAR_MAGIC_LEN 6
-#define TAR_VERSION_LEN 2
/* POSIX tar Header Block, from POSIX 1003.1-1990 */
#define NAME_SIZE 100
@@ -208,15 +204,14 @@ static inline int writeTarHeader(struct TarBallInfo *tbInfo,
memset(&header, 0, size);
- strncpy(header.name, header_name, sizeof(header.name));
+ safe_strncpy(header.name, header_name, sizeof(header.name));
putOctal(header.mode, sizeof(header.mode), statbuf->st_mode);
putOctal(header.uid, sizeof(header.uid), statbuf->st_uid);
putOctal(header.gid, sizeof(header.gid), statbuf->st_gid);
putOctal(header.size, sizeof(header.size), 0); /* Regular file size is handled later */
putOctal(header.mtime, sizeof(header.mtime), statbuf->st_mtime);
- strncpy(header.magic, TAR_MAGIC TAR_VERSION,
- TAR_MAGIC_LEN + TAR_VERSION_LEN);
+ strcpy(header.magic, "ustar ");
/* Enter the user and group names (default to root if it fails) */
if (bb_getpwuid(header.uname, statbuf->st_uid, sizeof(header.uname)) == NULL)