[master] f6e7eb7a0 Guard against underflow in diagnostics

Poul-Henning Kamp phk at FreeBSD.org
Tue Jun 25 06:26:05 UTC 2024


commit f6e7eb7a0c1ace1874559e52ec566fa19bd0db8f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Jun 25 06:25:14 2024 +0000

    Guard against underflow in diagnostics

diff --git a/bin/varnishtest/vtc_haproxy.c b/bin/varnishtest/vtc_haproxy.c
index d2d9d5daa..b3e047dd4 100644
--- a/bin/varnishtest/vtc_haproxy.c
+++ b/bin/varnishtest/vtc_haproxy.c
@@ -267,7 +267,7 @@ haproxy_cli_recv(struct haproxy_cli *hc)
 		}
 		/* Connection closed. */
 		if (ret == 0) {
-			if (hc->rxbuf[rdz - 1] != '\n')
+			if (rdz > 0 && hc->rxbuf[rdz - 1] != '\n')
 				vtc_fatal(hc->vl,
 				    "CLI rx timeout (fd: %d %.3fs ret: %zd)",
 				    hc->sock, hc->timeout, ret);


More information about the varnish-commit mailing list