mirror of https://github.com/OISF/suricata
defrag: make frag_end and tracker id conversions explicit
-fsanitize=implicit-conversion flags the frag_offset + data_len narrowing into the uint16_t frag_end. For both IPv4 and IPv6, compute frag_end after the too-large check so the sum always fits, and make the narrowing an explicit cast. For IPv6 this moves the existing IPV6_MAXPACKET check above the frag_end assignment. It used to sit at the end of the branch, after frag_end was already computed. Nothing reads frag_end in between, so behaviour is the same. Oversize fragments are still dropped with IPV6_FRAG_PKT_TOO_LARGE, and the wrap can no longer happen, which matches the IPv4 path. Also drop the vestigial int32 casts when assigning the uint32_t tracker id. Ticket: 8232pull/16253/head
parent
38c9b1e0e0
commit
e6a45d6e4e
Loading…
Reference in New Issue