Missing trailing \0 in SOPC_NodeId_ToCString for bytestring IDs
Description
SOPC_NodeId_ToCString
does not put a trailing \0
to the returned char*
when the type of the NodeId is SOPC_IdentifierType_ByteString
, which may lead to buffer overflows.
Analysis
The comments in the code say that "b=<bstring>\0"
should be produced, but the newly allocated memory may not have a trailing \0
.
A simple solution is to replace the malloc
by a calloc
.