[master] 50048822a Respect the end of input buffer when skipping the second [CR]LF after the headers.

Poul-Henning Kamp phk at FreeBSD.org
Mon Aug 13 07:12:05 UTC 2018


commit 50048822ae88fcfe4202e9cdaf5f9bc6f65084f9
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Aug 13 07:10:40 2018 +0000

    Respect the end of input buffer when skipping the second [CR]LF
    after the headers.
    
    Fixes: #2731

diff --git a/bin/varnishd/http1/cache_http1_proto.c b/bin/varnishd/http1/cache_http1_proto.c
index ac1a2a86e..dd81863d3 100644
--- a/bin/varnishd/http1/cache_http1_proto.c
+++ b/bin/varnishd/http1/cache_http1_proto.c
@@ -206,8 +206,11 @@ http1_dissect_hdrs(struct http *hp, char *p, struct http_conn *htc,
 			return (400);
 		}
 	}
-	if (p < htc->rxbuf_e)
-		p += vct_skipcrlf(p);
+	/* We cannot use vct_skipcrlf() we have to respect rxbuf_e */
+	if (p+2 <= htc->rxbuf_e && p[0] == '\r' && p[1] == '\n')
+		p += 2;
+	else if (p+1 <= htc->rxbuf_e && p[0] == '\n')
+		p += 1;
 	HTC_RxPipeline(htc, p);
 	htc->rxbuf_e = p;
 	return (0);


More information about the varnish-commit mailing list