1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

make updater fail if there is not enough space to fit the new firmware (#2405)

This commit is contained in:
Me No Dev
2016-08-18 09:59:35 +03:00
committed by GitHub
parent 4ececda82b
commit b250381d80

View File

@ -226,12 +226,17 @@ bool UpdaterClass::_writeBuffer(){
}
size_t UpdaterClass::write(uint8_t *data, size_t len) {
size_t left = len;
if(hasError() || !isRunning())
return 0;
if(len > remaining())
len = remaining();
if(len > remaining()){
//len = remaining();
//fail instead
_error = UPDATE_ERROR_SPACE;
return 0;
}
size_t left = len;
while((_bufferLen + left) > FLASH_SECTOR_SIZE) {
size_t toBuff = FLASH_SECTOR_SIZE - _bufferLen;