[master] 94283ee Fix a harmless signextension bug.

Poul-Henning Kamp phk at FreeBSD.org
Tue Jan 16 10:28:04 UTC 2018


commit 94283eed20cfac5b1c7c49b9cc6bdf5c540b156a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Jan 16 10:27:31 2018 +0000

    Fix a harmless signextension bug.

diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c
index dc5550e..7df0858 100644
--- a/lib/libvarnishapi/vsc.c
+++ b/lib/libvarnishapi/vsc.c
@@ -106,7 +106,7 @@ static const struct VSC_level_desc * const levels[] = {
 #undef VSC_LEVEL_F
 };
 
-static const size_t nlevels = sizeof(levels)/sizeof(*levels);
+static const ssize_t nlevels = sizeof(levels)/sizeof(*levels);
 
 /*--------------------------------------------------------------------*/
 
@@ -496,8 +496,8 @@ VSC_ChangeLevel(const struct VSC_level_desc *old, int chg)
 			break;
 	if (i == nlevels)
 		i = 0;
-	else
-		i += chg;
+
+	i += chg;
 	if (i >= nlevels)
 		i = nlevels - 1;
 	if (i < 0)


More information about the varnish-commit mailing list