From c9d495ceb8e26eeb351f24457f70c10e3ac9ea61 Mon Sep 17 00:00:00 2001 From: joerg Date: Tue, 28 Aug 2001 21:27:36 +0000 Subject: In get_string(), 0-terminate the contents of buf ``just in case''; otherwise, if the very first fgetc() already yielded EOF, the returned string won't get terminated at all. MFC after: 1 day --- usr.bin/truss/syscalls.c | 1 + 1 file changed, 1 insertion(+) (limited to 'usr.bin/truss') diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index 29e8c29..cd92deb 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -124,6 +124,7 @@ get_string(int procfd, void *offset, int max) { err(1, "fdopen"); buf = malloc( size = (max ? max : 64 ) ); len = 0; + buf[0] = 0; fseek(p, (long)offset, SEEK_SET); while ((c = fgetc(p)) != EOF) { buf[len++] = c; -- cgit v1.1