]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
config/flow: fix division by zero
authorPhilippe Antoine <pantoine@oisf.net>
Wed, 30 Aug 2023 12:48:56 +0000 (14:48 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 5 Sep 2023 12:21:33 +0000 (14:21 +0200)
Fixes: 805b07fa4236 ("src: checks to avoid divisions by zero")
Coverity id: 1539152

Ticket: #5920
Ticket: #6255

src/flow.c

index 891a5fb9b94d1f53face2f2e5b8a2f3a2207dfd9..9783b7883b0bb88e7daa87de6c704cb558848349 100644 (file)
@@ -606,10 +606,11 @@ void FlowInitConfig(bool quiet)
             FatalError("Invalid value for flow.hash-size: NULL");
         }
 
-        if (StringParseUint32(&configval, 10, strlen(conf_val), conf_val) > 0 || configval == 0) {
+        if (StringParseUint32(&configval, 10, strlen(conf_val), conf_val) && configval != 0) {
             flow_config.hash_size = configval;
         } else {
-            FatalError("Invalid value for flow.hash-size");
+            FatalError("Invalid value for flow.hash-size. Must be a numeric value in the range "
+                       "1-4294967295");
         }
     }
     if ((ConfGet("flow.prealloc", &conf_val)) == 1)