Files
freeswitch/tests/unit
Dmitry Verenitsin 03485e1f4c [core] Harden STUN attribute parsing bounds and USERNAME copy (#3112)
Bounds and termination fixes across the STUN attribute receive path
in `handle_ice` and `switch_stun_lookup`:

- `switch_stun_packet_next_attribute` and its `_hbo` variant now
  confirm the 4-byte attribute header is fully within `end` before
  dereferencing `type`/`length`, and include the header when checking
  that the value fits, so a truncated or overrunning attribute is not
  read past the buffer.
- Compute `end_buf` as the 20-byte STUN header plus the attribute
  section (`SWITCH_STUN_PACKET_MIN_LEN + header.length`) so the walk
  covers every attribute, including trailing ones.
- Make `switch_stun_packet_next_attribute` the sole loop terminator
  and drop the redundant `xlen` guard; its seed differed between the
  two functions and could skip a trailing attribute in
  `switch_stun_lookup`.
- `switch_stun_packet_attribute_get_username` reserves a byte for the
  terminator and always NUL-terminates, since callers use the result
  as a C string.
2026-08-08 22:33:58 +03:00
..
2026-08-08 17:48:05 +03:00
2019-11-21 22:06:14 +04:00
2026-05-26 22:02:42 +03:00
2025-07-31 19:38:54 +03:00
2024-12-03 21:30:46 +01:00
2026-08-08 19:47:47 +03:00
2024-12-03 21:30:46 +01:00
2024-10-11 20:16:39 +02:00
2024-12-03 21:30:46 +01:00
2026-08-08 19:47:47 +03:00
2026-08-08 18:18:50 +03:00
2026-08-08 18:29:25 +03:00
2021-04-27 13:54:32 -06:00
2026-08-08 21:02:15 +03:00
2026-08-08 17:48:05 +03:00
2026-05-26 22:02:42 +03:00
2024-12-03 21:30:46 +01:00

FreeSWITCH unit tests should be kept as shallow unit tests and micro
benchmarks testing functionality exposed through libfreeswitch.

Requirements for a new unit tests: 

1. Tests must use switch_test.h framework