mmaraya / port-mirroring

OpenWrt package for copying network packets without iptables
BSD 2-Clause "Simplified" License
102 stars 32 forks source link

CID 27357: Integer handling issues (BAD_SHIFT) #30

Closed mmaraya closed 8 years ago

mmaraya commented 8 years ago

Integer handling issues (BAD_SHIFT) in getSenderInterface() https://github.com/mmaraya/port-mirroring/blob/962e0110526785a8efb67768b6b59402c24f6077/port-mirroring.c#L565

large_shift: In expression ({...}) << 32U - dstMask, left shifting by more than 31 bits has undefined behavior. The shift amount, 32U - dstMask, is 32.

The operaton may have an undefined behavior or yield to an unexpected result. In getSenderInterface: A bit shift operation has a shift amount which is too large or has a negative value.