From fb4ed8a511dacfac40d5dc8fae6a7ee78c069e38 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pali=20Roh=C3=A1r?= Date: Wed, 12 Feb 2020 18:08:46 +0100 Subject: [PATCH] exfat: Fix parsing exfat label According to released exfat specification, label is only 22 bytes long. --- libblkid/src/superblocks/exfat.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libblkid/src/superblocks/exfat.c b/libblkid/src/superblocks/exfat.c index 7622320d39..62fb8ce0b8 100644 --- a/libblkid/src/superblocks/exfat.c +++ b/libblkid/src/superblocks/exfat.c @@ -33,7 +33,8 @@ struct exfat_super_block { struct exfat_entry_label { uint8_t type; uint8_t length; - uint8_t name[30]; + uint8_t name[22]; + uint8_t reserved[8]; } __attribute__((__packed__)); #define BLOCK_SIZE(sb) (1u << (sb)->block_bits) @@ -125,7 +126,8 @@ static int probe_exfat(blkid_probe pr, const struct blkid_idmag *mag) label = find_label(pr, sb); if (label) blkid_probe_set_utf8label(pr, label->name, - min(label->length * 2, 30), BLKID_ENC_UTF16LE); + min(label->length * 2, sizeof(label->name)), + BLKID_ENC_UTF16LE); else if (errno) return -errno; -- 2.47.3