Skip to content

Stream Corruption Bug on UDPDatagramTransport #35

@Liparakis

Description

@Liparakis

Note: Not really a threat as buffer sizes are guaranteed to be Max MTU, but this should still be corrected.

// Example: Packet is 500 bytes, buffer is 400 bytes
if (len < data.Length)
{
    // Current read: only reads first 400 bytes 
    // (incomplete/garbage if using DTLS)
    
    // The Bug: the remaining 100 bytes of Packet A are saved
    ReceivedDataCollection.Add(leftover100Bytes); 
}

// RESULT: On the next read, the data stream looks like:
// [100 bytes from Packet A] + [start of Packet B]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions