Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Dec 2010 09:18:11 +0000 (UTC)
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r216224 - head/usr.bin/truss
Message-ID:  <201012060918.oB69IB9L027166@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 		}
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012060918.oB69IB9L027166>