[master] 3e8c1812d Coverity polish: 1605314 Overflowed return value

Nils Goroll nils.goroll at uplex.de
Thu Sep 12 12:30:06 UTC 2024


commit 3e8c1812deb8a533c57130d39c4aa04e516f60c0
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Sep 12 14:25:09 2024 +0200

    Coverity polish: 1605314 Overflowed return value
    
    Coverity seems to not understand that read will not return more than len, and
    thus i + l can never be greated than len.
    
    Try to help it...

diff --git a/bin/varnishd/http1/cache_http1_vfp.c b/bin/varnishd/http1/cache_http1_vfp.c
index d10df7ac5..20f349d1c 100644
--- a/bin/varnishd/http1/cache_http1_vfp.c
+++ b/bin/varnishd/http1/cache_http1_vfp.c
@@ -81,9 +81,9 @@ v1f_read(const struct vfp_ctx *vc, struct http_conn *htc, void *d, ssize_t len)
 			    TOSTRAND(VAS_errtxt(errno)));
 			return (i);
 		}
+		assert(i <= len);
 		if (i == 0)
 			htc->doclose = SC_RESP_CLOSE;
-
 	}
 	return (i + l);
 }


More information about the varnish-commit mailing list