summaryrefslogtreecommitdiff
path: root/lib/tar/write_header.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-25 23:50:46 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-25 23:52:17 +0200
commitb485c92efac16d94a6a613bb6f839f36ba0b28be (patch)
tree0caa388dab30ccc5fb62cb4e638275962a809d0c /lib/tar/write_header.c
parentab063437ce4271d31c150a19390c6d6b18aedf04 (diff)
Use safer string copy function to fill tar header
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/tar/write_header.c')
-rw-r--r--lib/tar/write_header.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/tar/write_header.c b/lib/tar/write_header.c
index 19b00bd..0686200 100644
--- a/lib/tar/write_header.c
+++ b/lib/tar/write_header.c
@@ -65,7 +65,7 @@ static int write_header(int fd, const struct stat *sb, const char *name,
memset(&hdr, 0, sizeof(hdr));
- memcpy(hdr.name, name, strlen(name));
+ strncpy(hdr.name, name, sizeof(hdr.name) - 1);
write_number(hdr.mode, sb->st_mode & ~S_IFMT, sizeof(hdr.mode));
write_number(hdr.uid, sb->st_uid, sizeof(hdr.uid));
write_number(hdr.gid, sb->st_gid, sizeof(hdr.gid));