-
-
Notifications
You must be signed in to change notification settings - Fork 739
Description
In file: storage/norcow.c in function norcow_ptr there is a check for avoiding an out-of-bounds read of array STORAGE_AREAS:
static const void *norcow_ptr(uint8_t sector, uint32_t offset, uint32_t size) { ensure(sectrue * (sector <= NORCOW_SECTOR_COUNT), "invalid sector"); return flash_area_get_address(&STORAGE_AREAS[sector], offset, size); }
This exact code is also seen in test files: "storage/tests/c0/norcow.c" and "storage/tests/c3/norcow.c"
And as far as i understand NORCOW_SECTOR_COUNT is equal to the size of STORAGE_AREAS so the check should be < instead of <=. (since if NORCOW_SECTOR_COUNT == sector that would be a out-of-bound read)
This issue is (as far as i can tell) very minor since norcow_ptr is only used with functions that never give it a sector that is equal to NORCOW_SECTOR_COUNT but it sill should probably be fixed (or removed entirely?)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status