mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 18:56:38 +00:00
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) {
|
if (XdrvMailbox.data_len < 20) {
|
||||||
return true; // No valid data
|
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();
|
JsonParserObject domoticz = parser.getRootObject();
|
||||||
if (!domoticz) {
|
if (!domoticz) {
|
||||||
return true; // To much or invalid data
|
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"}
|
// 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)
|
String jsonStr = json; // Move from stack to heap to fix watchdogs (20180626)
|
||||||
|
|
||||||
JsonParser parser((char*)jsonStr.c_str());
|
JsonParser parser((char*)jsonStr.c_str());
|
||||||
JsonParserObject root = parser.getRootObject();
|
JsonParserObject root = parser.getRootObject();
|
||||||
if (root) { // did JSON parsing went ok?
|
if (root) { // did JSON parsing went ok?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user