diff --git a/src/MQTTProtocolClient.c b/src/MQTTProtocolClient.c index be2caa1a..4217af0f 100644 --- a/src/MQTTProtocolClient.c +++ b/src/MQTTProtocolClient.c @@ -579,7 +579,7 @@ int MQTTProtocol_handlePubcomps(void* pack, int sock) (m->MQTTVersion >= MQTTVERSION_5) ? PERSISTENCE_V5_PUBLISH_SENT : PERSISTENCE_PUBLISH_SENT, m->qos, pubcomp->msgId); if (rc != 0) - Log(LOG_ERROR, -1, "Error removing PUBCOMP msgid id %d from persistence", client->clientID, pubcomp->msgId); + Log(LOG_ERROR, -1, "Error removing PUBCOMP for client id %s msgid %d from persistence", client->clientID, pubcomp->msgId); #endif MQTTProtocol_removePublication(m->publish); if (m->MQTTVersion >= MQTTVERSION_5) diff --git a/src/MQTTVersion.c b/src/MQTTVersion.c index 10ff36ee..8e7ee36d 100644 --- a/src/MQTTVersion.c +++ b/src/MQTTVersion.c @@ -80,7 +80,7 @@ char* FindString(char* filename, const char* eyecatcher_input) if ((infile = fopen(filename, "rb")) != NULL) { size_t buflen = strlen(eyecatcher); - char* buffer = (char*) malloc(buflen); /* lgtm [cpp/no-space-for-terminator] */ + char* buffer = (char*) malloc(buflen + 1); /* added space for unused null terminator to stop LGTM complaint */ if (buffer != NULL) {