[master] e41f29a23 Try to make Coverity understand the code

Nils Goroll nils.goroll at uplex.de
Mon Sep 16 13:43:05 UTC 2024


commit e41f29a2380080be42e9b18383b5dff877c8d3b4
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Sep 16 15:40:55 2024 +0200

    Try to make Coverity understand the code
    
    Idea from bugwash discussing #4173

diff --git a/lib/libvarnishapi/vsl_cursor.c b/lib/libvarnishapi/vsl_cursor.c
index 1dedb3cc9..1c957b6bd 100644
--- a/lib/libvarnishapi/vsl_cursor.c
+++ b/lib/libvarnishapi/vsl_cursor.c
@@ -340,6 +340,8 @@ vslc_file_readn(int fd, void *buf, ssize_t n)
 	ssize_t t = 0;
 	ssize_t l;
 
+	assert(n > 0);
+
 	while (t < n) {
 		l = read(fd, (char *)buf + t, n - t);
 		if (l <= 0)


More information about the varnish-commit mailing list