Fix ESP32 RCSwitch Dump Stack Smash Protection (#636)

Fixes https://github.com/esphome/issues/issues/366
This commit is contained in:
Otto Winter 2019-06-14 12:34:45 +02:00
parent 80b48f01fb
commit 88c129e705
No known key found for this signature in database
GPG key ID: DB66C0BE6013F97E

View file

@ -232,7 +232,7 @@ bool RCSwitchDumper::dump(RemoteReceiveData src) {
uint8_t out_nbits;
RCSwitchBase *protocol = &rc_switch_protocols[i];
if (protocol->decode(src, &out_data, &out_nbits) && out_nbits >= 3) {
char buffer[32];
char buffer[33];
for (uint8_t j = 0; j < out_nbits; j++)
buffer[j] = (out_data & (1 << (out_nbits - j - 1))) ? '1' : '0';