Skip to main content

admit_declared_received_len

Function admit_declared_received_len 

Source
pub fn admit_declared_received_len(
    declared: u64,
    max_bytes: u64,
    kind: &str,
) -> Result<usize>
Expand description

Admit a declared receive length before any buffer is reserved or grown.

declared is untrusted wire input. Compare it to max_bytes as u64 before converting to usize so a hostile header cannot pick the allocation. This function does not reserve or allocate.