svn commit: r258558 - stable/10/contrib/libexecinfo

Ed Maste emaste at FreeBSD.org
Mon Nov 25 15:54:19 UTC 2013


Author: emaste
Date: Mon Nov 25 15:54:18 2013
New Revision: 258558
URL: http://svnweb.freebsd.org/changeset/base/258558

Log:
  MFC r258426: libexecinfo: Include terminating null in byte count
  
    Otherwise, a formatted string with a strlen equal to the remaining
    buffer space would have the last character omitted (because vsnprintf
    always null-terminates), and later the assert in backtrace_symbols_fmt
    would fail.
  
  Sponsored by:	DARPA, AFRL
  Approved by:	re (gjb)

Modified:
  stable/10/contrib/libexecinfo/backtrace.c
Directory Properties:
  stable/10/contrib/libexecinfo/   (props changed)

Modified: stable/10/contrib/libexecinfo/backtrace.c
==============================================================================
--- stable/10/contrib/libexecinfo/backtrace.c	Mon Nov 25 15:53:08 2013	(r258557)
+++ stable/10/contrib/libexecinfo/backtrace.c	Mon Nov 25 15:54:18 2013	(r258558)
@@ -89,7 +89,7 @@ rasprintf(char **buf, size_t *bufsiz, si
 			len = vsnprintf(*buf + offs, *bufsiz - offs, fmt, ap);
 			va_end(ap);
 
-			if (len < 0 || (size_t)len < *bufsiz - offs)
+			if (len < 0 || (size_t)len + 1 < *bufsiz - offs)
 				return len;
 			nbufsiz = MAX(*bufsiz + 512, (size_t)len + 1);
 		} else


More information about the svn-src-all mailing list