diff --git a/tasmota/xdrv_23_zigbee_7_5_map.ino b/tasmota/xdrv_23_zigbee_7_5_map.ino index f6a50e974..7320f71e2 100644 --- a/tasmota/xdrv_23_zigbee_7_5_map.ino +++ b/tasmota/xdrv_23_zigbee_7_5_map.ino @@ -142,6 +142,15 @@ bool Z_Mapper::addEdge(const Z_Mapper_Edge & edge2) { return true; } +String EscapeHTMLString(const char *s_P) { + String s((const __FlashStringHelper*) s_P); + s.replace(F("&"), F("&")); + s.replace(F("\""), F(""")); + s.replace(F("<"), F("<")); + s.replace(F(">"), F(">")); + return s; +} + void Z_Mapper::dumpInternals(void) const { WSContentSend_P(PSTR("nodes:[" "{id:\"0x0000\",label:\"Coordinator\",group:\"o\",title:\"0x0000\"}")); for (const auto & device : zigbee_devices.getDevices()) { @@ -150,7 +159,7 @@ void Z_Mapper::dumpInternals(void) const { const char *fname = device.friendlyName; if (fname != nullptr) { - WSContentSend_P(PSTR("%s"), fname); + WSContentSend_P(PSTR("%s"), EscapeJSONString(fname).c_str()); } else { WSContentSend_P(PSTR("0x%04X"), device.shortaddr); } diff --git a/tasmota/xdrv_23_zigbee_A_impl.ino b/tasmota/xdrv_23_zigbee_A_impl.ino index 5636b905a..2fdc89846 100644 --- a/tasmota/xdrv_23_zigbee_A_impl.ino +++ b/tasmota/xdrv_23_zigbee_A_impl.ino @@ -1960,9 +1960,9 @@ void ZigbeeShow(bool json) WSContentSend_PD(msg[ZB_WEB_STATUS_LINE], shortaddr, - device.modelId ? device.modelId : "", - device.manufacturerId ? device.manufacturerId : "", - name, sbatt, slqi); + device.modelId ? EscapeHTMLString(device.modelId).c_str() : "", + device.manufacturerId ? EscapeHTMLString(device.manufacturerId).c_str() : "", + EscapeHTMLString(name).c_str(), sbatt, slqi); if(device.validLqi()) { for(uint32_t j = 0; j < 4; ++j) {