Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Oct 2015 09:23:15 +0000 (UTC)
From:      Poul-Henning Kamp <phk@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r288484 - head/sys/kern
Message-ID:  <201510020923.t929NFKK004063@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: phk
Date: Fri Oct  2 09:23:14 2015
New Revision: 288484
URL: https://svnweb.freebsd.org/changeset/base/288484

Log:
  Fail the sbuf if vsnprintf(3) fails.

Modified:
  head/sys/kern/subr_sbuf.c

Modified: head/sys/kern/subr_sbuf.c
==============================================================================
--- head/sys/kern/subr_sbuf.c	Fri Oct  2 09:03:28 2015	(r288483)
+++ head/sys/kern/subr_sbuf.c	Fri Oct  2 09:23:14 2015	(r288484)
@@ -623,6 +623,10 @@ sbuf_vprintf(struct sbuf *s, const char 
 		va_copy(ap_copy, ap);
 		len = vsnprintf(&s->s_buf[s->s_len], SBUF_FREESPACE(s) + 1,
 		    fmt, ap_copy);
+		if (len < 0) {
+			s->s_error = errno;
+			return (-1);
+		}
 		va_end(ap_copy);
 
 		if (SBUF_FREESPACE(s) >= len)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510020923.t929NFKK004063>