[master] 5de84f39d slink assures me that blobs can use size_t for ->len, and that this one <= 0 test is an oversight.

Poul-Henning Kamp phk at FreeBSD.org
Tue Feb 5 08:36:08 UTC 2019


commit 5de84f39dc715ade7e08d63466294663adc47eee
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Feb 5 08:35:08 2019 +0000

    slink assures me that blobs can use size_t for ->len, and that this
    one <= 0 test is an oversight.

diff --git a/include/vrt.h b/include/vrt.h
index 2e4ed2301..d3d055945 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -178,7 +178,7 @@ struct strands {
 
 struct vrt_blob {
 	unsigned	type;
-	long		len;
+	size_t		len;
 	const void	*blob;
 };
 
diff --git a/lib/libvmod_directors/vmod_shard.c b/lib/libvmod_directors/vmod_shard.c
index 4495474d3..e709e9cf0 100644
--- a/lib/libvmod_directors/vmod_shard.c
+++ b/lib/libvmod_directors/vmod_shard.c
@@ -571,7 +571,7 @@ shard_param_args(VRT_CTX,
 					 who, p->vcl_name, by_s);
 				return (NULL);
 			}
-			if (key_blob == NULL || key_blob->len <= 0 ||
+			if (key_blob == NULL || key_blob->len == 0 ||
 			    key_blob->blob == NULL) {
 				sharddir_err(ctx, SLT_Error, "%s %s: "
 					     "by=BLOB but no or empty key_blob "


More information about the varnish-commit mailing list