svn commit: r216224 - head/usr.bin/truss

Jaakko Heinonen jh at FreeBSD.org
Mon Dec 6 09:18:12 UTC 2010


Author: jh
Date: Mon Dec  6 09:18:11 2010
New Revision: 216224
URL: http://svn.freebsd.org/changeset/base/216224

Log:
  Don't write the terminating NUL past end of buffer.
  
  PR:		bin/152345
  Submitted by:	Mateusz Guzik

Modified:
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscalls.c
==============================================================================
--- head/usr.bin/truss/syscalls.c	Mon Dec  6 00:19:56 2010	(r216223)
+++ head/usr.bin/truss/syscalls.c	Mon Dec  6 09:18:11 2010	(r216224)
@@ -518,7 +518,7 @@ get_string(pid_t pid, void *offset, int 
 			buf = realloc(buf, totalsize);
 			size = BLOCKSIZE;
 		} else {
-			buf[totalsize] = '\0';
+			buf[totalsize - 1] = '\0';
 			return (buf);
 		}
 	}


More information about the svn-src-all mailing list