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 committed by GitHub
parent 36f47ade70
commit 4fee9cc039
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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';