Skip to main content

check_full_track_name

Function check_full_track_name 

Source
fn check_full_track_name(
    namespace: &TrackNamespace,
    track_name: &[u8],
) -> Result<(), CodecError>
Expand description

Hold a namespace-plus-name pair to the Full Track Name cap.

Draft-17 Section 2.4.1: “The maximum total length of a Full Track Name is 4,096 bytes. The length of a Full Track Name is computed as the sum of the Track Namespace Field Length fields and the Track Name Length field… If an endpoint receives a Track Namespace or a Full Track Name exceeding 4,096 bytes, it MUST close the session with a PROTOCOL_VIOLATION.”

The namespace half of that sentence is enforced inside the namespace decoder, which is the only place that sees a namespace with no name beside it. This is the other half, and it has to live where the two are decoded together: a namespace at 4,000 bytes and a name at 500 are each legal alone.

A control message can be 65,535 bytes, so without this a peer can hand the application a Full Track Name sixteen times the permitted size — and two relays that disagree about whether it was legal disagree about cache identity.