mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 01:30:30 -04:00
libalias: fix divide by zero causing panic
The packet_limit can fall to 0, leading to a divide by zero abort in
the "packets % packet_limit".
An possible solution would be to apply a lower limit of 1 after the
calculation of packet_limit, but since any number modulo 1 gives 0,
the more efficient solution is to skip the modulo operation for
packet_limit <= 1.
Reported by: Karl Denninger <karl@denninger.net>
(cherry picked from commit 58080fbca0)
This commit is contained in:
parent
1fcecff2b3
commit
791035c8da
1 changed files with 1 additions and 1 deletions
|
|
@ -1769,7 +1769,7 @@ HouseKeeping(struct libalias *la)
|
|||
* Reduce the amount of house keeping work substantially by
|
||||
* sampling over the packets.
|
||||
*/
|
||||
if (packets % packet_limit == 0) {
|
||||
if (packet_limit <= 1 || packets % packet_limit == 0) {
|
||||
time_t now;
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
|
|
|||
Loading…
Reference in a new issue