-
Notifications
You must be signed in to change notification settings - Fork 721
Description
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.