summaryrefslogtreecommitdiff
path: root/src/archive.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2019-02-13 15:44:03 +0200
committerTimo Teräs <timo.teras@iki.fi>2019-02-13 16:05:27 +0200
commit44daf808737f85ff462905269c7a1e66d52e2fff (patch)
tree08a62633282647b9695adc2a460b1dbe0799bab6 /src/archive.c
parent86922d1a34fc1004f439b0b86bfbd908a9f07422 (diff)
downloadapk-tools-44daf808737f85ff462905269c7a1e66d52e2fff.tar.gz
apk-tools-44daf808737f85ff462905269c7a1e66d52e2fff.tar.bz2
apk-tools-44daf808737f85ff462905269c7a1e66d52e2fff.tar.xz
apk-tools-44daf808737f85ff462905269c7a1e66d52e2fff.zip
fix strncpy bounds errors
error: 'strncpy' specified bound 4096 equals destination size [-Werror=stringop-truncation] Based on patch by Elan Ruusamäe <glen@delfi.ee>
Diffstat (limited to 'src/archive.c')
-rw-r--r--src/archive.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/archive.c b/src/archive.c
index 1745056..724410c 100644
--- a/src/archive.c
+++ b/src/archive.c
@@ -387,10 +387,10 @@ int apk_tar_write_entry(struct apk_ostream *os, const struct apk_file_info *ae,
return -1;
if (ae->name != NULL)
- strncpy(buf.name, ae->name, sizeof(buf.name));
+ strlcpy(buf.name, ae->name, sizeof buf.name);
- strncpy(buf.uname, ae->uname ?: "root", sizeof(buf.uname));
- strncpy(buf.gname, ae->gname ?: "root", sizeof(buf.gname));
+ strlcpy(buf.uname, ae->uname ?: "root", sizeof buf.uname);
+ strlcpy(buf.gname, ae->gname ?: "root", sizeof buf.gname);
PUT_OCTAL(buf.size, ae->size);
PUT_OCTAL(buf.uid, ae->uid);