[4.1] a9e6766 Add an assert preventing buffer overflows
Martin Blix Grydeland
martin at varnish-software.com
Mon Dec 5 16:00:06 CET 2016
commit a9e67666349b5654102621281022464408fe8df8
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Mon Nov 28 11:56:49 2016 +0100
Add an assert preventing buffer overflows
Make sure that the workspace can accomodate the pipelined data before
memmoving it into place in SES_RxReInit.
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 0e2a746..6c5930b 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -177,6 +177,7 @@ SES_RxReInit(struct http_conn *htc)
if (htc->pipeline_b != NULL) {
l = htc->pipeline_e - htc->pipeline_b;
assert(l > 0);
+ assert(l <= htc->ws->r - htc->rxbuf_b);
memmove(htc->rxbuf_b, htc->pipeline_b, l);
htc->rxbuf_e += l;
htc->pipeline_b = NULL;
More information about the varnish-commit
mailing list