From: Philippe Antoine Date: Wed, 30 Aug 2023 12:48:56 +0000 (+0200) Subject: config/flow: fix division by zero X-Git-Tag: suricata-7.0.1~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=541cafa40a1a6a7d183f9105f61160c986e2e3e0;p=thirdparty%2Fsuricata.git config/flow: fix division by zero Fixes: 805b07fa4236 ("src: checks to avoid divisions by zero") Coverity id: 1539152 Ticket: #5920 Ticket: #6255 --- diff --git a/src/flow.c b/src/flow.c index 891a5fb9b9..9783b7883b 100644 --- a/src/flow.c +++ b/src/flow.c @@ -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)