Fix char[] allocation

This commit is contained in:
Hadinger 2020-01-12 23:31:57 +01:00
parent 50717849bb
commit 5840f71af9
5 changed files with 6 additions and 6 deletions

View File

@ -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) {

View File

@ -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; }

View File

@ -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);

View File

@ -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);

View File

@ -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; }