svn commit: r258426 - head/contrib/libexecinfo
Ed Maste
emaste at FreeBSD.org
Thu Nov 21 14:12:37 UTC 2013
Author: emaste
Date: Thu Nov 21 14:12:36 2013
New Revision: 258426
URL: http://svnweb.freebsd.org/changeset/base/258426
Log:
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.
MFC after: 3 days
Sponsored by: DARPA, AFRL
Modified:
head/contrib/libexecinfo/backtrace.c
Modified: head/contrib/libexecinfo/backtrace.c
==============================================================================
--- head/contrib/libexecinfo/backtrace.c Thu Nov 21 09:19:14 2013 (r258425)
+++ head/contrib/libexecinfo/backtrace.c Thu Nov 21 14:12:36 2013 (r258426)
@@ -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-head
mailing list