Date: Thu, 21 Nov 2013 14:12:37 +0000 (UTC) From: Ed Maste <emaste@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258426 - head/contrib/libexecinfo Message-ID: <201311211412.rALECbPj017752@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311211412.rALECbPj017752>