diff options
| author | Milan Broz <gmazyland@gmail.com> | 2022-11-24 10:54:01 +0100 |
|---|---|---|
| committer | Milan Broz <gmazyland@gmail.com> | 2022-11-24 10:58:52 +0100 |
| commit | 2a71e291d0fe247d7ca62775e47865dda4b2acfd (patch) | |
| tree | 194a6eaac7d9887a59edcda9dd5ef235bbc9a1b6 /libblkid/src/superblocks | |
| parent | 7155e836defb336536d39dd9aed57770c55b1aa9 (diff) | |
| download | util-linux-2a71e291d0fe247d7ca62775e47865dda4b2acfd.tar.gz | |
libblkid: fix misaligned-address in probe_exfat
Value checked in le32_to_cpu() needs to be properly
aligned. Just copy the value temporarily for conversion.
Fix OSS-Fuzz issue 53696
Diffstat (limited to 'libblkid/src/superblocks')
| -rw-r--r-- | libblkid/src/superblocks/exfat.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libblkid/src/superblocks/exfat.c b/libblkid/src/superblocks/exfat.c index e76060490..370340487 100644 --- a/libblkid/src/superblocks/exfat.c +++ b/libblkid/src/superblocks/exfat.c @@ -72,16 +72,17 @@ static uint64_t cluster_to_offset(const struct exfat_super_block *sb, static uint32_t next_cluster(blkid_probe pr, const struct exfat_super_block *sb, uint32_t cluster) { - uint32_t *next; + uint32_t *nextp, next; uint64_t fat_offset; fat_offset = block_to_offset(sb, le32_to_cpu(sb->FatOffset)) + (uint64_t) cluster * sizeof(cluster); - next = (uint32_t *) blkid_probe_get_buffer(pr, fat_offset, + nextp = (uint32_t *) blkid_probe_get_buffer(pr, fat_offset, sizeof(uint32_t)); - if (!next) + if (!nextp) return 0; - return le32_to_cpu(*next); + memcpy(&next, nextp, sizeof(next)); + return le32_to_cpu(next); } static struct exfat_entry_label *find_label(blkid_probe pr, |
