[master] 2c8ec9dc9 Flexelint

Nils Goroll nils.goroll at uplex.de
Sun Feb 9 14:41:05 UTC 2025


commit 2c8ec9dc9b4f0e8d9162a4a2a7997b2475f3a896
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Sun Feb 9 15:38:44 2025 +0100

    Flexelint
    
    I had actually run it locally, but only in the vmod directory, and I overlooked
    that vmod_debug gets linted from bin/varnishd.
    
    Ref 4c86b89419142c8c2ae1bdf8399348d1b5272df6

diff --git a/vmod/vmod_debug.c b/vmod/vmod_debug.c
index 299b8461d..fd1100451 100644
--- a/vmod/vmod_debug.c
+++ b/vmod/vmod_debug.c
@@ -1353,12 +1353,14 @@ xyzzy_log_strands(VRT_CTX, VCL_STRING prefix, VCL_STRANDS subject, VCL_INT nn)
 	AN(subject);
 	if (nn > INT_MAX)
 		n = INT_MAX;
+	if (nn < 0)
+		n = 0;
 	else
 		n = nn;
 
 	for (i = 0; i < subject->n; i++) {
 		const char *p = subject->p[i];
 		mylog(ctx->vsl, SLT_Debug, "%s[%d]: (%s) %p %.*s%s", prefix, i,
-		    ptr_where(ctx, p), p, n, p, strlen(p) > n ? "..." : "");
+		    ptr_where(ctx, p), p, n, p, strlen(p) > (unsigned)n ? "..." : "");
 	}
 }


More information about the varnish-commit mailing list