Skip to content

Add internal capacity management to RawPacket #1910

@Dimi1010

Description

@Dimi1010

Currently RawPacket's methods insertData and appendData can cause memory corruption if used incorrectly.

The packet class tracks the "written" bytes but does not track the actual buffer capacity. This behavior both forces the user of the class to track the buffer capacity manually and significantly lessens the possibility of safety checks inside the class.

The proposal is for the integration of a capacity field in RawPacket that tracks the total buffer capacity in addition to written bytes. This would allow the class to operate as a container, reallocating automatically if allowed when adding more data and raising an error if it can't. The change would increase memory safety as the user won't have the chance of making the class cause a read access violations by incorrect tracking of the internal capacity.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions