Module Name: src Committed By: christos Date: Thu Nov 21 16:02:21 UTC 2013
Modified Files: src/lib/libexecinfo: backtrace.c Log Message: >From Ed Maste: 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. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libexecinfo/backtrace.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libexecinfo/backtrace.c diff -u src/lib/libexecinfo/backtrace.c:1.3 src/lib/libexecinfo/backtrace.c:1.4 --- src/lib/libexecinfo/backtrace.c:1.3 Thu Aug 29 10:58:56 2013 +++ src/lib/libexecinfo/backtrace.c Thu Nov 21 11:02:21 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: backtrace.c,v 1.3 2013/08/29 14:58:56 christos Exp $ */ +/* $NetBSD: backtrace.c,v 1.4 2013/11/21 16:02:21 christos Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__RCSID("$NetBSD: backtrace.c,v 1.3 2013/08/29 14:58:56 christos Exp $"); +__RCSID("$NetBSD: backtrace.c,v 1.4 2013/11/21 16:02:21 christos Exp $"); #include <sys/param.h> #include <assert.h> @@ -88,7 +88,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