[master] 0757b3807 Coverity polish: 1605322 Overflowed integer argument

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


commit 0757b380798d4c28b1c70b6a4bb1b12e4abf0530
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Sep 12 12:52:07 2024 +0200

    Coverity polish: 1605322 Overflowed integer argument
    
    we do want all 32bits of seed to be passed to srand48(), and if the cast results
    in a a negative number, that's fine. Let's see if Coverity can be appeased this
    way, otherwise we'll probably need to ignore the report.

diff --git a/lib/libvarnish/vrnd.c b/lib/libvarnish/vrnd.c
index d72b697ad..87929427b 100644
--- a/lib/libvarnish/vrnd.c
+++ b/lib/libvarnish/vrnd.c
@@ -196,5 +196,5 @@ VRND_SeedAll(void)
 	AZ(VRND_RandomCrypto(&seed, sizeof seed));
 	VRND_SeedTestable(seed);
 	AZ(VRND_RandomCrypto(&seed, sizeof seed));
-	srand48(seed);
+	srand48((long)seed);
 }


More information about the varnish-commit mailing list