Skip to content

Commit

Permalink
config/flow: Avoid divide by zero at startup
Browse files Browse the repository at this point in the history
Accommodate flow hash sizes of 0 for startup message. We don't expect
the hash-size to be configured to 0, but if it is, avoid divide by 0
when displaying the config information.

Issue: 6255
  • Loading branch information
jlucovsky committed Aug 19, 2023
1 parent becb8ce commit 00443b8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,8 @@ void FlowInitConfig(bool quiet)
uint32_t sz = sizeof(Flow) + FlowStorageSize();
SCLogConfig("flow size %u, memcap allows for %" PRIu64 " flows. Per hash row in perfect "
"conditions %" PRIu64,
sz, flow_memcap_copy / sz, (flow_memcap_copy / sz) / flow_config.hash_size);
sz, flow_memcap_copy / sz,
flow_config.hash_size > 0 ? (flow_memcap_copy / sz) / flow_config.hash_size : 0);
return;
}

Expand Down

0 comments on commit 00443b8

Please sign in to comment.