mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
protect the write method writing more than supposed to
This commit is contained in:
parent
bfbfd31315
commit
d969115cda
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user