_az_json_writer_escape_and_copy( ) - Out-Of-Bounds Write (CWE-787) #2238
Labels
Azure.Core
bug
This issue requires a change to an existing behavior in the product in order to be resolved.
Client
This issue points to a problem in the data-plane of the library.
Overshoots the allocated Memory for destination, leads to over-writing other variables in adjacent memory.
File: src\azure\core\az_json_writer.c
API: _az_json_writer_escape_and_copy ( )
Line: 379
Issue: During encoding, if the source contains:
Each character requires 1 additional Byte.
Example: ‘\0’, ‘ACK’, ‘BS’, ‘ESC’, etc.
Each character requires 5 additional Bytes.
Solution :
A condition needs to be added after L:378 that checks for the availability of sufficient Memory Buffer in
remaining_destination
, in every iteration, depending on the type of character ch.The text was updated successfully, but these errors were encountered: