Skip to content

Commit

Permalink
Bug fix fat_file_read : wrong value in *size_read
Browse files Browse the repository at this point in the history
  • Loading branch information
konect-V committed Jun 23, 2024
1 parent 7266d9d commit ceccace
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sources/core/modules/fat32/source/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,10 @@ int fat_file_read(fat_file_internal_t* file, uint64_t start, size_t size, size_t
err = fat_read_cluster_chain(file->ctx, base_cluster, start, (uint64_t)size, &size_read_tmp, buffer);
}

if(size_read_tmp + start > file->entry.size){
size_read_tmp = file->entry.size - start;
}

*size_read = (size_t)size_read_tmp;

return err;
Expand Down

0 comments on commit ceccace

Please sign in to comment.