Commit 96f65a4b authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Fixed issue with malloc in file transfer chat message modifier

parent 49b5c04b
Pipeline #285 failed with stage
in 0 seconds
...@@ -583,9 +583,10 @@ static void fillFileTransferContentInformationsFromVndGsmaRcsFtHttpXml (FileTran ...@@ -583,9 +583,10 @@ static void fillFileTransferContentInformationsFromVndGsmaRcsFtHttpXml (FileTran
xmlChar *keyb64 = xmlNodeListGetString(xmlMessageBody, cur->xmlChildrenNode, 1); xmlChar *keyb64 = xmlNodeListGetString(xmlMessageBody, cur->xmlChildrenNode, 1);
size_t keyLength; size_t keyLength;
bctbx_base64_decode(NULL, &keyLength, (unsigned char *)keyb64, strlen((const char *)keyb64)); bctbx_base64_decode(NULL, &keyLength, (unsigned char *)keyb64, strlen((const char *)keyb64));
uint8_t *keyBuffer = (uint8_t *)malloc(keyLength); uint8_t *keyBuffer = (uint8_t *)malloc(keyLength + 1);
// decode the key into local key buffer // decode the key into local key buffer
bctbx_base64_decode(keyBuffer, &keyLength, (unsigned char *)keyb64, strlen((const char *)keyb64)); bctbx_base64_decode(keyBuffer, &keyLength, (unsigned char *)keyb64, strlen((const char *)keyb64));
+ keyBuffer[keyLength] = '\0';
fileTransferContent->setFileKey((const char *)keyBuffer, keyLength); fileTransferContent->setFileKey((const char *)keyBuffer, keyLength);
// duplicate key value into the linphone content private structure // duplicate key value into the linphone content private structure
xmlFree(keyb64); xmlFree(keyb64);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment