Fixed WS281x output on ESP32

Fixed potential out-of-bounds write in MQTT
Fixed IR pin not changeable if IR disabled
Fixed XML API <wv> containing -1 on Manual only RGBW mode (see #888, #1783)
This commit is contained in:
cschwinne
2021-05-20 21:41:39 +02:00
parent 1617658bfe
commit 371c4e0051
7 changed files with 18 additions and 15 deletions

View File

@@ -64,9 +64,9 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties
}
//make a copy of the payload to 0-terminate it
char* payloadStr = new char[len+1];
if (payloadStr == nullptr) return; //no mem
strncpy(payloadStr, payload, len);
payloadStr[len] = '\0';
if (payloadStr == nullptr) return; //no mem
DEBUG_PRINTLN(payloadStr);
size_t topicPrefixLen = strlen(mqttDeviceTopic);