bytestring_from_reader

Function bytestring_from_reader 

Source
pub fn bytestring_from_reader<R: Read>(
    r: &mut R,
    max_bytes_to_read: u64,
) -> Result<Vec<u8>>
Expand description

Reads a length-prefixed byte string from a reader, rejecting lengths above max_bytes_to_read. Matches Nitro’s util.BytestringFromReader 1:1 (arbos/util/util.go:172). Every caller must pass an explicit cap sized to the protocol context — typically MAX_L2_MESSAGE_SIZE (256 KiB) — so an attacker-controlled length prefix can never trigger a huge pre-allocation (DoS).