HomeFreeBSD

libalias: fix divide by zero causing panic

Description

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 58080fbca09fda6d5f011d37059edbca8ceb4c58)

Details

Provenance
seAuthored on Jul 10 2021, 11:00 AM
donnerCommitted on Jul 14 2021, 11:54 AM
Parents
rG1adc5faa2ae0: pf: rename pf_state to pf_kstate
Branches
Unknown
Tags
Unknown