aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-06-20 13:45:05 -0400
committerMike Frysinger <vapier@gentoo.org>2016-06-20 13:45:05 -0400
commite73183f42ef1b3915fca02fe3da044986c4cf98b (patch)
tree311e8b974eda37873aa5cd5ce839dfcbce3ca997 /paxinc.c
parentscanelf: fix out_format leak fix (diff)
downloadpax-utils-e73183f42ef1b3915fca02fe3da044986c4cf98b.tar.gz
pax-utils-e73183f42ef1b3915fca02fe3da044986c4cf98b.tar.bz2
pax-utils-e73183f42ef1b3915fca02fe3da044986c4cf98b.zip
ar: make sure file name is always NUL terminated
Diffstat (limited to 'paxinc.c')
-rw-r--r--paxinc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/paxinc.c b/paxinc.c
index bd13ec4..068aa60 100644
--- a/paxinc.c
+++ b/paxinc.c
@@ -109,9 +109,10 @@ close_and_ret:
if (read(ar->fd, ret.buf.formatted.name, len) != len)
goto close_and_ret;
} else {
- s = alloca(sizeof(char) * len);
+ s = alloca(sizeof(char) * len + 1);
if (read(ar->fd, s, len) != len)
goto close_and_ret;
+ s[len] = '\0';
}
} else if (s[0] == '/' && s[1] >= '0' && s[1] <= '9') {
/* GNU extended filename */