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