[experimental-ims] 57b4594 Don't overrun the VSL segment looking for the end.

Poul-Henning Kamp phk at FreeBSD.org
Thu Dec 18 10:27:55 CET 2014


commit 57b4594c3ad86afc0f656943cf20070cb8d3af57
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Aug 28 12:24:29 2012 +0000

    Don't overrun the VSL segment looking for the end.

diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c
index cd6034d..da9e5df 100644
--- a/lib/libvarnishapi/vsl.c
+++ b/lib/libvarnishapi/vsl.c
@@ -139,9 +139,12 @@ vsl_open(struct VSM_data *vd)
 	vsl->log_end = vsl->vf.e;
 	vsl->log_ptr = vsl->log_start + 1;
 	if (!vsl->d_opt) {
-		while (*vsl->log_ptr != VSL_ENDMARKER)
+		while (vsl->log_ptr < vsl->log_end &&
+		    *vsl->log_ptr != VSL_ENDMARKER)
 			vsl->log_ptr = VSL_NEXT(vsl->log_ptr);
 	}
+	if (vsl->log_ptr >= vsl->log_end)
+		vsl->log_ptr = vsl->log_start + 1;
 	return (0);
 }
 



More information about the varnish-commit mailing list