[master] b722682 Make it clear to coverity that we are not doing anything untoward with the frame length.

Poul-Henning Kamp phk at FreeBSD.org
Mon Feb 13 15:30:07 CET 2017


commit b72268214e2a58a8ed251c4fbf5e59ff71ab1384
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Feb 13 14:28:58 2017 +0000

    Make it clear to coverity that we are not doing anything untoward
    with the frame length.

diff --git a/bin/varnishd/http2/cache_http2_proto.c b/bin/varnishd/http2/cache_http2_proto.c
index 27872e7..5acf8a6 100644
--- a/bin/varnishd/http2/cache_http2_proto.c
+++ b/bin/varnishd/http2/cache_http2_proto.c
@@ -260,8 +260,6 @@ h2_vsl_frame(const struct h2_sess *h2, const void *ptr, size_t len)
 	if (len > 9)
 		VSLb_bin(h2->vsl, SLT_H2RxBody, len - 9, b + 9);
 
-	u = vbe32dec(b) >> 8;
-
 	vsb = VSB_new_auto();
 	AN(vsb);
 	p = h2_framename((enum h2frame)b[3]);
@@ -269,13 +267,15 @@ h2_vsl_frame(const struct h2_sess *h2, const void *ptr, size_t len)
 		VSB_cat(vsb, p);
 	else
 		VSB_quote(vsb, b + 3, 1, VSB_QUOTE_HEX);
+
+	u = vbe32dec(b) >> 8;
 	VSB_printf(vsb, "[%u] ", u);
 	VSB_quote(vsb, b + 4, 1, VSB_QUOTE_HEX);
 	VSB_putc(vsb, ' ');
 	VSB_quote(vsb, b + 5, 4, VSB_QUOTE_HEX);
 	if (u > 0) {
 		VSB_putc(vsb, ' ');
-		VSB_quote(vsb, b + 9, u, VSB_QUOTE_HEX);
+		VSB_quote(vsb, b + 9, len - 9, VSB_QUOTE_HEX);
 	}
 	AZ(VSB_finish(vsb));
 	VSLb(h2->vsl, SLT_Debug, "H2RXF %s", VSB_data(vsb));



More information about the varnish-commit mailing list