From bd07fbb1d559d16caae22ae44e78d02b2cc3595e Mon Sep 17 00:00:00 2001 From: Emmanuel Nicolet Date: Thu, 26 Dec 2019 21:02:37 +0100 Subject: tar: fix memory write error Clear the last byte of the allocated buffer. --- toys/posix/tar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toys') 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 -- cgit v1.2.3