Fix possible array overflow

Fix possible array overflow (#3887 )
This commit is contained in:
Theo Arends 2018-09-24 11:44:40 +02:00
parent 5560b6054e
commit f65d8c0cbf

View File

@ -462,10 +462,11 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
grpflg = (strstr(topicBuf, Settings.mqtt_grptopic) != NULL);
fallback_topic_flag = (strstr(topicBuf, mqtt_client) != NULL);
type = strrchr(topicBuf, '/') +1; // Last part of received topic is always the command (type)
type = strrchr(topicBuf, '/'); // Last part of received topic is always the command (type)
index = 1;
if (type != NULL) {
type++;
for (i = 0; i < strlen(type); i++) {
type[i] = toupper(type[i]);
}