mirror of
https://github.com/pellepl/spiffs.git
synced 2026-08-13 05:37:47 +00:00
Fix possible source of overflow in SPIFFS_check
pages_per_scan can overflow in some file system configurations. This could occur for example in a file system where the logical page size is 32 KiB and the type of spiffs_page_ix is uint16_t.
This commit is contained in:
+1
-1
@@ -521,7 +521,7 @@ s32_t spiffs_lookup_consistency_check(spiffs *fs, u8_t check_all_objects) {
|
||||
// The working memory might not fit all pages so several scans might be needed
|
||||
static s32_t spiffs_page_consistency_check_i(spiffs *fs) {
|
||||
const u32_t bits = 4;
|
||||
const spiffs_page_ix pages_per_scan = SPIFFS_CFG_LOG_PAGE_SZ(fs) * 8 / bits;
|
||||
const u32_t pages_per_scan = SPIFFS_CFG_LOG_PAGE_SZ(fs) * 8 / bits;
|
||||
|
||||
s32_t res = SPIFFS_OK;
|
||||
spiffs_page_ix pix_offset = 0;
|
||||
|
||||
Reference in New Issue
Block a user