[master] 519aeba7b vmod_blob flexelinting round 3

Nils Goroll nils.goroll at uplex.de
Tue Mar 10 12:58:07 UTC 2020


commit 519aeba7b9510c1cf27d47fef7165e5fd480ce53
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue Mar 10 13:56:23 2020 +0100

    vmod_blob flexelinting round 3
    
    it seems I wrongly assumed that SIZE_MAX would be defined as a positive
    integer, in fact it looks like (size_t)-1 was used.
    
    Ref: 2d8909407cad5e0c93d931024fa3e736062bdf5a

diff --git a/lib/libvmod_blob/vmod_blob.c b/lib/libvmod_blob/vmod_blob.c
index 0c46106bc..ec4e15aef 100644
--- a/lib/libvmod_blob/vmod_blob.c
+++ b/lib/libvmod_blob/vmod_blob.c
@@ -532,8 +532,9 @@ vmod_sub(VRT_CTX, VCL_BLOB b, VCL_BYTES n, VCL_BYTES off)
 
 	assert(b->len > 0);
 
-	if (off < 0 || n < 0 || off > SIZE_MAX || n > SIZE_MAX) {
-		ERR(ctx, "size or offset negative or out of range in blob.sub()");
+	// XXX check for > SIZE_MAX ?
+	if (off < 0 || n < 0) {
+		ERR(ctx, "size or offset negative in blob.sub()");
 		return (NULL);
 	}
 


More information about the varnish-commit mailing list