[master] f68da1e Fail the VSB if vsnprintf(3) fails.

Poul-Henning Kamp phk at FreeBSD.org
Fri Oct 2 11:23:47 CEST 2015


commit f68da1e503e39ce54645274fd9a81246160758f9
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Oct 2 09:23:33 2015 +0000

    Fail the VSB if vsnprintf(3) fails.

diff --git a/lib/libvarnish/vsb.c b/lib/libvarnish/vsb.c
index eba639e..63c196d 100644
--- a/lib/libvarnish/vsb.c
+++ b/lib/libvarnish/vsb.c
@@ -350,6 +350,10 @@ VSB_vprintf(struct vsb *s, const char *fmt, va_list ap)
 		va_copy(ap_copy, ap);
 		len = vsnprintf(&s->s_buf[s->s_len], VSB_FREESPACE(s) + 1,
 		    fmt, ap_copy);
+		if (len < 0) {
+			s->s_error = errno;
+			return (-1);
+		}
 		va_end(ap_copy);
 	} while (len > VSB_FREESPACE(s) &&
 	    VSB_extend(s, len - VSB_FREESPACE(s)) == 0);



More information about the varnish-commit mailing list