From 5840f71af9bc095e6f912296eaf01379e13ca160 Mon Sep 17 00:00:00 2001 From: Hadinger Date: Sun, 12 Jan 2020 23:31:57 +0100 Subject: [PATCH] Fix char[] allocation --- tasmota/xdrv_05_irremote.ino | 2 +- tasmota/xdrv_05_irremote_full.ino | 4 ++-- tasmota/xdrv_09_timers.ino | 2 +- tasmota/xdrv_17_rcswitch.ino | 2 +- tasmota/xdrv_23_zigbee_9_impl.ino | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tasmota/xdrv_05_irremote.ino b/tasmota/xdrv_05_irremote.ino index 3c9479937..6c6e16fdb 100644 --- a/tasmota/xdrv_05_irremote.ino +++ b/tasmota/xdrv_05_irremote.ino @@ -181,7 +181,7 @@ uint32_t IrRemoteCmndIrSendJson(void) // IRsend { "protocol": "RC5", "bits": 12, "data":"0xC86" } // IRsend { "protocol": "SAMSUNG", "bits": 32, "data": 551502015 } - char dataBufUc[XdrvMailbox.data_len]; + char dataBufUc[XdrvMailbox.data_len + 1]; UpperCase(dataBufUc, XdrvMailbox.data); RemoveSpace(dataBufUc); if (strlen(dataBufUc) < 8) { diff --git a/tasmota/xdrv_05_irremote_full.ino b/tasmota/xdrv_05_irremote_full.ino index 77fc3f7cc..14de34cbc 100644 --- a/tasmota/xdrv_05_irremote_full.ino +++ b/tasmota/xdrv_05_irremote_full.ino @@ -280,7 +280,7 @@ uint32_t IrRemoteCmndIrHvacJson(void) char parm_uc[12]; //AddLog_P2(LOG_LEVEL_DEBUG, PSTR("IRHVAC: Received %s"), XdrvMailbox.data); - char dataBufUc[XdrvMailbox.data_len]; + char dataBufUc[XdrvMailbox.data_len + 1]; UpperCase(dataBufUc, XdrvMailbox.data); RemoveSpace(dataBufUc); if (strlen(dataBufUc) < 8) { return IE_INVALID_JSON; } @@ -393,7 +393,7 @@ uint32_t IrRemoteCmndIrSendJson(void) // ArduinoJSON entry used to calculate jsonBuf: JSON_OBJECT_SIZE(3) + 40 = 96 // IRsend { "protocol": "RC5", "bits": 12, "data":"0xC86" } // IRsend { "protocol": "SAMSUNG", "bits": 32, "data": 551502015 } - char dataBufUc[XdrvMailbox.data_len]; + char dataBufUc[XdrvMailbox.data_len + 1]; UpperCase(dataBufUc, XdrvMailbox.data); RemoveSpace(dataBufUc); if (strlen(dataBufUc) < 8) { return IE_INVALID_JSON; } diff --git a/tasmota/xdrv_09_timers.ino b/tasmota/xdrv_09_timers.ino index b31a6a5ef..0804ce286 100644 --- a/tasmota/xdrv_09_timers.ino +++ b/tasmota/xdrv_09_timers.ino @@ -364,7 +364,7 @@ void CmndTimer(void) #if defined(USE_RULES)==0 && defined(USE_SCRIPT)==0 if (devices_present) { #endif - char dataBufUc[XdrvMailbox.data_len]; + char dataBufUc[XdrvMailbox.data_len + 1]; UpperCase(dataBufUc, XdrvMailbox.data); StaticJsonBuffer<256> jsonBuffer; JsonObject& root = jsonBuffer.parseObject(dataBufUc); diff --git a/tasmota/xdrv_17_rcswitch.ino b/tasmota/xdrv_17_rcswitch.ino index 4462a5e21..9cd2d14d8 100644 --- a/tasmota/xdrv_17_rcswitch.ino +++ b/tasmota/xdrv_17_rcswitch.ino @@ -105,7 +105,7 @@ void CmndRfSend(void) int repeat = 10; int pulse = 350; - char dataBufUc[XdrvMailbox.data_len]; + char dataBufUc[XdrvMailbox.data_len + 1]; UpperCase(dataBufUc, XdrvMailbox.data); StaticJsonBuffer<150> jsonBuf; // ArduinoJSON entry used to calculate jsonBuf: JSON_OBJECT_SIZE(5) + 40 = 134 JsonObject &root = jsonBuf.parseObject(dataBufUc); diff --git a/tasmota/xdrv_23_zigbee_9_impl.ino b/tasmota/xdrv_23_zigbee_9_impl.ino index 70c5659ca..408410f9b 100644 --- a/tasmota/xdrv_23_zigbee_9_impl.ino +++ b/tasmota/xdrv_23_zigbee_9_impl.ino @@ -548,7 +548,7 @@ void CmndZigbeeSend(void) { // Probe a specific device to get its endpoints and supported clusters void CmndZigbeeProbe(void) { if (zigbee.init_phase) { ResponseCmndChar(D_ZIGBEE_NOT_STARTED); return; } - char dataBufUc[XdrvMailbox.data_len]; + char dataBufUc[XdrvMailbox.data_len + 1]; UpperCase(dataBufUc, XdrvMailbox.data); RemoveSpace(dataBufUc); if (strlen(dataBufUc) < 3) { ResponseCmndChar("Invalid destination"); return; }