[master] cc8740e72 signedness fixes

Nils Goroll nils.goroll at uplex.de
Sat Apr 4 15:14:07 UTC 2020


commit cc8740e72825a551315d4155595d3c3d0d0082cd
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Sat Apr 4 17:09:15 2020 +0200

    signedness fixes
    
    reported by flexelint

diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c
index b174f3142..f825273b2 100644
--- a/bin/varnishd/proxy/cache_proxy_proto.c
+++ b/bin/varnishd/proxy/cache_proxy_proto.c
@@ -320,7 +320,6 @@ VPX_tlv(const struct req *req, int typ, void **dst, int *len)
 static int
 vpx_proto2(const struct worker *wrk, struct req *req)
 {
-	int l, hdr_len;
 	uintptr_t *up;
 	uint16_t tlv_len;
 	const uint8_t *p, *ap, *pp;
@@ -333,7 +332,7 @@ vpx_proto2(const struct worker *wrk, struct req *req)
 	char pb[VTCP_PORTBUFSIZE];
 	struct vpx_tlv_iter vpi[1], vpi2[1];
 	struct vpx_tlv *tlv;
-	unsigned flen, alen;
+	unsigned l, hdr_len, flen, alen;
 	unsigned const plen = 2, aoff = 16;
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
@@ -343,7 +342,7 @@ vpx_proto2(const struct worker *wrk, struct req *req)
 	assert(req->htc->rxbuf_e - req->htc->rxbuf_b >= 16L);
 	l = vbe16dec(req->htc->rxbuf_b + 14);
 	hdr_len = l + 16L;
-	assert(req->htc->rxbuf_e - req->htc->rxbuf_b >= hdr_len);
+	assert(req->htc->rxbuf_e >= req->htc->rxbuf_b + hdr_len);
 	HTC_RxPipeline(req->htc, req->htc->rxbuf_b + hdr_len);
 	WS_Rollback(req->ws, 0);
 	p = (const void *)req->htc->rxbuf_b;
@@ -398,7 +397,7 @@ vpx_proto2(const struct worker *wrk, struct req *req)
 
 	if (l < flen) {
 		VSL(SLT_ProxyGarbage, req->sp->vxid,
-		    "PROXY2: Ignoring short %s addresses (%d)",
+		    "PROXY2: Ignoring short %s addresses (%u)",
 		    pfam == AF_INET ? "IPv4" : "IPv6", l);
 		return (0);
 	}
diff --git a/lib/libvcc/vcc_acl.c b/lib/libvcc/vcc_acl.c
index c3fb9a6ce..60e4321a4 100644
--- a/lib/libvcc/vcc_acl.c
+++ b/lib/libvcc/vcc_acl.c
@@ -115,7 +115,7 @@ vcc_acl_chk(struct vcc *tl, const struct acl_e *ae, const int l,
 	assert (ll >= 0);
 	m %= 8;
 
-	if (m && (*p << m & 0xff) != 0) {
+	if (m && (*p << m & UINT8_C(0xff)) != 0) {
 		ret = 1;
 		m = 0xff00 >> m;
 		*p &= m;


More information about the varnish-commit mailing list