Closed StefanHri closed 3 years ago
I can't find this version of the code. What version of TinyCBOR are you using?
The function _cbor_value_copy_string
was introduced in commit ff130bc339dbc0ae1fceca2949858b8ebad909ca and did not look like that. The braces in the function also do not match the coding style I use.
I am using TinyCBOR from ZephyrOS https://github.com/zephyrproject-rtos/tinycbor/blob/31ae89e4b768612722620cb6cb173a0de4a19cc9/src/cborparser.c#L1292
Please report to them. Their copy is modified.
The documentation of the function cbor_value_copy_byte_string says:
However, the null byte is appended without checking if the size of buffer:
This causes that one byte belonging to some other variable is overwritten.