mirror of
https://github.com/littlefs-project/littlefs.git
synced 2025-11-16 12:34:34 +00:00
fix corruption check
This commit is contained in:
3
lfs.c
3
lfs.c
@@ -46,8 +46,7 @@ static int lfs_bd_read(lfs_t *lfs,
|
||||
lfs_block_t block, lfs_off_t off,
|
||||
void *buffer, lfs_size_t size) {
|
||||
uint8_t *data = buffer;
|
||||
if (lfs->block_count &&
|
||||
(block >= lfs->block_count || off+size > lfs->cfg->block_size)) {
|
||||
if (off+size > lfs->cfg->block_size || (lfs->block_count && block >= lfs->block_count)) {
|
||||
return LFS_ERR_CORRUPT;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user