1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

protect the write method writing more than supposed to

This commit is contained in:
John Doe 2015-07-03 14:19:23 +03:00 committed by Ivan Grokhotkov
parent bfbfd31315
commit d969115cda

View File

@ -121,6 +121,9 @@ size_t UpdaterClass::write(uint8_t *data, size_t len){
if(hasError())
return 0;
if(len > remaining())
len = remaining();
while((_bufferLen + left) > FLASH_SECTOR_SIZE){
size_t toBuff = FLASH_SECTOR_SIZE - _bufferLen;
memcpy(_buffer + _bufferLen, data + (len - left), toBuff);