storage/flash_map: Fix flash area bounds checking
The commit adds check if offset is positive; previously negative offset would be allowed, which means that writing flash before flash area start was possible. Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit is contained in:
parent
b574c4f626
commit
f20cc4b7a4
1 changed files with 1 additions and 1 deletions
|
@ -80,7 +80,7 @@ void flash_area_close(const struct flash_area *fa)
|
|||
static inline bool is_in_flash_area_bounds(const struct flash_area *fa,
|
||||
off_t off, size_t len)
|
||||
{
|
||||
return (off <= fa->fa_size && off + len <= fa->fa_size);
|
||||
return (off >= 0) && ((off + len) <= fa->fa_size);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_FLASH_PAGE_LAYOUT)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue