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);
                }
        }
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to