Commit 81b6d4f2 authored by Dominik Ermel's avatar Dominik Ermel Committed by Anas Nashif
Browse files

storage/flash_map: Fix is_in_flash_area_bounds



Prevent possible overflow in is_in_flash_area_bounds while
validating offset and length of an operation.

Fixes #89349

Signed-off-by: default avatarDominik Ermel <dominik.ermel@nordicsemi.no>
(cherry picked from commit 3d4b4272)
parent 85f003c8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ static inline struct flash_area const *get_flash_area_from_id(int idx)
static inline bool is_in_flash_area_bounds(const struct flash_area *fa,
					   off_t off, size_t len)
{
	return (off >= 0) && ((off + len) <= fa->fa_size);
	return (off >= 0) && (off < fa->fa_size) && (len <= (fa->fa_size - off));
}

#endif /* ZEPHYR_SUBSYS_STORAGE_FLASH_MAP_PRIV_H_ */