Skip to content

Commit

Permalink
Fix for 1technophile#1458: crash on ASCII and HEX data
Browse files Browse the repository at this point in the history
  • Loading branch information
xopr committed Mar 12, 2023
1 parent c4dcc82 commit 8c3ebda
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main/ZgatewayLORA.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 8c3ebda

Please sign in to comment.