From cdfc719c2e8b20c0841b8dcb7af77e2c24c5610a Mon Sep 17 00:00:00 2001 From: Jaakko Heinonen Date: Mon, 6 Dec 2010 09:18:11 +0000 Subject: [PATCH] Don't write the terminating NUL past end of buffer. PR: bin/152345 Submitted by: Mateusz Guzik --- usr.bin/truss/syscalls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index 7ef8e1981728..f19553d21674 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -518,7 +518,7 @@ get_string(pid_t pid, void *offset, int max) buf = realloc(buf, totalsize); size = BLOCKSIZE; } else { - buf[totalsize] = '\0'; + buf[totalsize - 1] = '\0'; return (buf); } }