Fix for #1458: crash on ASCII and HEX data (#1526)

This commit is contained in:
xopr authored and GitHub committed 2023-03-12 15:52:24 -05:00
1 parent df020efd8b
commit 97750611f8
1 file changed
+5 -1
+5 -1
View File
@@ -73,6 +73,10 @@ Try and determine device given the JSON type
uint8_t _determineDevice(JsonObject& LORAdata) {
const char* protocol_name = LORAdata["type"];
// No type provided
if (!protocol_name)
return UNKNOWN_DEVICE;
if (strcmp(protocol_name, "WiPhone") == 0)
return WIPHONE;
@@ -240,7 +244,7 @@ void MQTTtoLORA(char* topicOri, JsonObject& LORAdata) { // json object decoding
// We have hex data: create convert to binary
byte raw[strlen(hex) / 2];
_hexToRaw(hex, raw, sizeof(raw));
LoRa.print((char*)raw);
LoRa.write((uint8_t*)raw, sizeof(raw));
} else {
// ascii payload
LoRa.print(message);