Skip to content

Commit

Permalink
make updater fail if there is not enough space to fit the new firmware (
Browse files Browse the repository at this point in the history
  • Loading branch information
me-no-dev authored Aug 18, 2016
1 parent 4ececda commit b250381
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cores/esp8266/Updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b250381

Please sign in to comment.