From 8e0d52ec52d8d6106be7ad24db1b8e9ccf2682ac Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 17 Jan 2018 14:48:27 +0100 Subject: [PATCH] Do not crash in lime if either message or content type is NULL --- coreapi/lime.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/coreapi/lime.c b/coreapi/lime.c index ba4e00027..efeecf45f 100644 --- a/coreapi/lime.c +++ b/coreapi/lime.c @@ -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;