mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 01:29:21 -04:00
fatfs: Fix possible integer overflow in esp_vfs_fat_info()
This commit is contained in:
parent
7e71c0cff2
commit
2565acbc28
@ -222,8 +222,8 @@ esp_err_t esp_vfs_fat_info(const char* base_path,
|
||||
errno = fresult_to_errno(res);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
uint64_t total_sectors = (fs->n_fatent - 2) * fs->csize;
|
||||
uint64_t free_sectors = free_clusters * fs->csize;
|
||||
uint64_t total_sectors = ((uint64_t)(fs->n_fatent - 2)) * fs->csize;
|
||||
uint64_t free_sectors = ((uint64_t)free_clusters) * fs->csize;
|
||||
|
||||
// Assuming the total size is < 4GiB, should be true for SPI Flash
|
||||
if (out_total_bytes != NULL) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user