mirror of https://github.com/arendst/Tasmota.git
Fix possible buffer overwrites
This commit is contained in:
parent
b8e55203b6
commit
81cd344beb
|
@ -206,7 +206,9 @@ bool DomoticzMqttData(void) {
|
|||
if (XdrvMailbox.data_len < 20) {
|
||||
return true; // No valid data
|
||||
}
|
||||
JsonParser parser(XdrvMailbox.data);
|
||||
|
||||
String domoticz_data = XdrvMailbox.data; // Copy the string into a new buffer that will be modified
|
||||
JsonParser parser((char*)domoticz_data.c_str());
|
||||
JsonParserObject domoticz = parser.getRootObject();
|
||||
if (!domoticz) {
|
||||
return true; // To much or invalid data
|
||||
|
|
|
@ -1166,7 +1166,6 @@ void DisplayAnalyzeJson(char *topic, char *json)
|
|||
// tele/th1/SENSOR {"Time":"2017-09-20T11:54:48","DS18B20":{"Temperature":49.7},"TempUnit":"C"}
|
||||
|
||||
String jsonStr = json; // Move from stack to heap to fix watchdogs (20180626)
|
||||
|
||||
JsonParser parser((char*)jsonStr.c_str());
|
||||
JsonParserObject root = parser.getRootObject();
|
||||
if (root) { // did JSON parsing went ok?
|
||||
|
|
Loading…
Reference in New Issue