aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Nicolet <emmanuel.nicolet@gmail.com>2019-12-26 21:02:37 +0100
committerRob Landley <rob@landley.net>2019-12-28 15:06:41 -0600
commitbd07fbb1d559d16caae22ae44e78d02b2cc3595e (patch)
tree2191b738fbdcc060edaea6cc4585373514ea3440
parent4817036313bde019e4639bf52e7a6c52ca715c61 (diff)
downloadtoybox-bd07fbb1d559d16caae22ae44e78d02b2cc3595e.tar.gz
tar: fix memory write error
Clear the last byte of the allocated buffer.
-rw-r--r--toys/posix/tar.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/tar.c b/toys/posix/tar.c
index 1e662589..0327c894 100644
--- a/toys/posix/tar.c
+++ b/toys/posix/tar.c
@@ -169,7 +169,7 @@ static void alloread(void *buf, int len)
free(*b);
*b = xmalloc(len+1);
xreadall(TT.fd, *b, len);
- b[len] = 0;
+ ((char*)(*b))[len] = 0;
}
// callback from dirtree to create archive