Fix possible buffer overflow

This commit is contained in:
nicandris 2020-09-19 14:02:15 +02:00
parent a9af3baea0
commit 7adab74ed5
1 changed files with 2 additions and 2 deletions

View File

@ -897,8 +897,8 @@ void Z_Devices::jsonPublishFlush(uint16_t shortaddr) {
if (Settings.flag4.zigbee_distinct_topics) { if (Settings.flag4.zigbee_distinct_topics) {
if (Settings.flag4.zb_topic_fname && fname) { if (Settings.flag4.zb_topic_fname && fname) {
char frtopic[13]; char frtopic[13 + strlen(fname)];
snprintf_P(frtopic, sizeof(frtopic) + strlen(fname), PSTR("tele/%s/" D_RSLT_SENSOR), fname); snprintf_P(frtopic, sizeof(frtopic), PSTR("tele/%s/" D_RSLT_SENSOR), fname);
MqttPublish(frtopic, Settings.flag.mqtt_sensor_retain); MqttPublish(frtopic, Settings.flag.mqtt_sensor_retain);
} else { } else {
char subtopic[16]; char subtopic[16];