Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure TCP::OptionTypes has 8-bit range (mfontanini#259)
When reading TCP packets with esoteric (or corrupt) values for option types, the asan fsanitize=enum will trigger if the read value is not in range of the enum. The range of a classic (pre-C++11) enum with no negative enumerators is determined by the highest bit set in any of its enumerators, so if `TCP::OptionTypes` has highest enumerator `ALTCHK = 14` it cannot take values above 15. Define enumerators (per IANA) with bit 7 set to ensure that `TCP::OptionTypes` can take any 8-bit value. An alternative (C++11 only) would be to give `TCP::OptionTypes` underlying type `uint8_t`.
- Loading branch information