From: Karel Zak Date: Wed, 15 Apr 2026 18:26:25 +0000 (+0200) Subject: libblkid: vfat: avoid 32-bit overflow in offset calculations X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=6319df1d5728c034305ba982e3a8d81601e1ee14;p=thirdparty%2Futil-linux.git libblkid: vfat: avoid 32-bit overflow in offset calculations Signed-off-by: Karel Zak --- diff --git a/libblkid/src/superblocks/vfat.c b/libblkid/src/superblocks/vfat.c index 6822bcdba..a3ae46a0a 100644 --- a/libblkid/src/superblocks/vfat.c +++ b/libblkid/src/superblocks/vfat.c @@ -328,7 +328,7 @@ static int probe_vfat(blkid_probe pr, const struct blkid_idmag *mag) if (ms->ms_fat_length) { /* the label may be an attribute in the root directory */ - uint32_t root_start = (reserved + fat_size) * sector_size; + uint64_t root_start = ((uint64_t) reserved + fat_size) * sector_size; uint32_t root_dir_entries = unaligned_le16(&vs->vs_dir_entries); if (search_fat_label(pr, root_start, root_dir_entries, vol_label_buf)) @@ -366,7 +366,7 @@ static int probe_vfat(blkid_probe pr, const struct blkid_idmag *mag) int count; next_sect_off = (next - 2) * vs->vs_cluster_size; - next_off = (uint64_t)(start_data_sect + next_sect_off) * + next_off = ((uint64_t) start_data_sect + next_sect_off) * sector_size; count = buf_size / sizeof(struct vfat_dir_entry);