Tags: pion/stun
Tags
Fix UnknownAttributes encoding to match RFC 5389 (#280) Pion uses 4 bytes per attribute type instead of 2 as specified in RFC 5389. On send side it is not so bad, other STUN peer will see extra zero attributes, so most likely it will be able to deal with this. In opposite direction there is a data loss, half of received attributes is silently discarded when pion decodes received packet.
Fix panic on short XOR-MAPPED-ADDRESS value XORMappedAddress.GetFromAs read value[0:2] to decode the address family before validating the attribute value length. A malformed STUN message carrying an XOR-MAPPED-ADDRESS attribute with a 0-length value at the end of a tightly allocated buffer triggered a slice-bounds runtime panic, since the value slice had no spare capacity to re-slice into. Move the length check ahead of the first read so a short value returns io.ErrUnexpectedEOF instead of panicking. This is remotely triggerable on normal STUN/ICE Binding-response parsing paths. Reported by Karolina GORNA Reported-By: karolina.gorna@ledger.com Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PreviousNext