diff options
author | Rob Landley <rob@landley.net> | 2015-01-01 16:59:35 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2015-01-01 16:59:35 -0600 |
commit | 82effc97f9f2d1c258ea50cb11b130753b8ba805 (patch) | |
tree | f6c584d2b1675a91eb1a016977560ff7148c15a1 /toys/pending/tar.c | |
parent | 5f53d130b1eae9041cc88c0ffb89e2b5823da393 (diff) | |
download | toybox-82effc97f9f2d1c258ea50cb11b130753b8ba805.tar.gz |
Switch a lot of strncpy() calls to xstrncpy().
Diffstat (limited to 'toys/pending/tar.c')
-rw-r--r-- | toys/pending/tar.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/toys/pending/tar.c b/toys/pending/tar.c index 5b060c6e..dc1480c4 100644 --- a/toys/pending/tar.c +++ b/toys/pending/tar.c @@ -189,7 +189,7 @@ static void add_file(struct archive_handler *tar, char **nam, struct stat *st) } memset(&hdr, 0, sizeof(hdr)); - strncpy(hdr.name, hname, sizeof(hdr.name)); + xstrncpy(hdr.name, hname, sizeof(hdr.name)); itoo(hdr.mode, sizeof(hdr.mode), st->st_mode &07777); itoo(hdr.uid, sizeof(hdr.uid), st->st_uid); itoo(hdr.gid, sizeof(hdr.gid), st->st_gid); @@ -202,7 +202,7 @@ static void add_file(struct archive_handler *tar, char **nam, struct stat *st) hdr.type = '1'; if (strlen(node->arg) > sizeof(hdr.link)) write_longname(tar, hname, 'K'); //write longname LINK - strncpy(hdr.link, node->arg, sizeof(hdr.link)); + xstrncpy(hdr.link, node->arg, sizeof(hdr.link)); } else if (S_ISREG(st->st_mode)) { hdr.type = '0'; if (st->st_size <= (off_t)0777777777777LL) @@ -219,7 +219,7 @@ static void add_file(struct archive_handler *tar, char **nam, struct stat *st) } if (strlen(lnk) > sizeof(hdr.link)) write_longname(tar, hname, 'K'); //write longname LINK - strncpy(hdr.link, lnk, sizeof(hdr.link)); + xstrncpy(hdr.link, lnk, sizeof(hdr.link)); free(lnk); } else if (S_ISDIR(st->st_mode)) hdr.type = '5'; |