File tree 1 file changed +7
-0
lines changed
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -97,12 +97,18 @@ bool UpdaterClass::begin(size_t size, int command) {
97
97
_md5 = MD5Builder ();
98
98
99
99
if (command == U_FLASH) {
100
+ // Basic sanity, if it's larger than entire FS then it can't possibly succeed
101
+ if (&_FS_start + size > &_FS_end) {
102
+ _setError (UPDATE_ERROR_SPACE);
103
+ return false ;
104
+ }
100
105
LittleFS.begin ();
101
106
_fp = LittleFS.open (" firmware.bin" , " w+" );
102
107
if (!_fp) {
103
108
#ifdef DEBUG_UPDATER
104
109
DEBUG_UPDATER.println (F (" [begin] unable to create file" ));
105
110
#endif
111
+ _setError (UPDATE_ERROR_SPACE);
106
112
return false ;
107
113
}
108
114
updateStartAddress = 0 ; // Not used
@@ -288,6 +294,7 @@ bool UpdaterClass::end(bool evenIfRemaining) {
288
294
bool UpdaterClass::_writeBuffer () {
289
295
if (_command == U_FLASH) {
290
296
if (_bufferLen != _fp.write (_buffer, _bufferLen)) {
297
+ _setError (UPDATE_ERROR_SPACE);
291
298
return false ;
292
299
}
293
300
} else {
You can’t perform that action at this time.
0 commit comments