Do not crash in lime if either message or content type is NULL

This commit is contained in:
Sylvain Berfini 2018-01-17 14:48:27 +01:00
parent b6badebe89
commit 8e0d52ec52

View file

@ -475,6 +475,9 @@ int lime_createMultipartMessage(void *cachedb, const char *contentType, uint8_t
if (bzrtp_getSelfZID(cachedb, selfURI, selfZid, NULL) != 0) {
return LIME_UNABLE_TO_ENCRYPT_MESSAGE;
}
if (message == NULL || contentType == NULL) {
return LIME_UNABLE_TO_ENCRYPT_MESSAGE;
}
/* encrypted message length is plaintext + 16 for tag */
encryptedMessageLength = (uint32_t)strlen((char *)message) + 16;