mirror of https://github.com/arendst/Tasmota.git
Fix command Publish payload handling
This commit is contained in:
parent
bfb7f0c1b9
commit
42461aaaf3
|
@ -852,13 +852,13 @@ void CmndPrefix(void)
|
|||
void CmndPublish(void)
|
||||
{
|
||||
if (XdrvMailbox.data_len > 0) {
|
||||
char *mqtt_part = strtok(XdrvMailbox.data, " ");
|
||||
char *payload_part;
|
||||
char *mqtt_part = strtok_r(XdrvMailbox.data, " ", &payload_part);
|
||||
if (mqtt_part) {
|
||||
char stemp1[TOPSZ];
|
||||
strlcpy(stemp1, mqtt_part, sizeof(stemp1));
|
||||
mqtt_part = strtok(nullptr, " ");
|
||||
if (mqtt_part) {
|
||||
strlcpy(mqtt_data, mqtt_part, sizeof(mqtt_data));
|
||||
if ((payload_part != nullptr) && strlen(payload_part)) {
|
||||
strlcpy(mqtt_data, payload_part, sizeof(mqtt_data));
|
||||
} else {
|
||||
mqtt_data[0] = '\0';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue