1
0
mirror of https://github.com/coturn/coturn.git synced 2026-10-24 00:08:57 +03:00
Files
coturn/src
alhuda c8866bdf9f clamp software copy length in handle_old_stun_command (#2050)
Repro: build so `TURN_SOFTWARE` is longer than 120 bytes (e.g. a long
`-DTURN_SERVER_BUILD_INFO`), run with `--rfc3489-compatibility` and
`--software-attribute`, then send a legacy RFC 3489 Binding request.
ASan reports a `stack-buffer-overflow` WRITE at the `memcpy` in
`handle_old_stun_command`.
Cause: the SERVER/SOFTWARE string is copied into `uint8_t software[120]`
via `memcpy(software, get_version(server), oldsz)`. The neighbouring `if
(newsz > sizeof(software))` clamp bounds `newsz` (the attribute length)
but never `oldsz`, so the copy length stays uncapped. Both old-STUN
response sites carry it.
Fix: bound the copy to `min(oldsz, sizeof(software))`. `oldsz` can be
shorter than the rounded-up `newsz`, so copying `newsz` would over-read
the source; the buffer is zero-initialised so the trailing pad bytes
stay zero.
2026-08-09 22:35:11 -07:00
..
2026-07-26 23:04:31 -07:00
2026-08-08 14:56:48 -07:00