libblkid-tiny: vfat: Fix reading labels which starts with byte 0x05
authorPali Rohár <pali.rohar@gmail.com>
Tue, 17 Dec 2019 07:28:35 +0000 (08:28 +0100)
committerRafał Miłecki <rafal@milecki.pl>
Fri, 20 Dec 2019 06:44:23 +0000 (07:44 +0100)
commit e526f503918cc29d8b1ccf36a5c3a34645d2be6e upstream.

When FAT directory entry has leading byte 0x05 it is interpreted as byte
0xE5. This is how FAT stores file name which starts with byte 0xE5 as
leading byte in 0xE5 in FAT directory entry means that file slot is empty.

Fixes: #533

libblkid-tiny/vfat.c

index 49b865adf0bce98923f929fa00364f6f93d85426..93e40530c897a56f9805ab41c07dd82cb013afe8 100644 (file)
@@ -167,6 +167,8 @@ static unsigned char *search_fat_label(blkid_probe pr,
                if ((ent->attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) ==
                    FAT_ATTR_VOLUME_ID) {
                        DBG(LOWPROBE, ul_debug("\tfound fs LABEL at entry %d", i));
+                       if (ent->name[0] == 0x05)
+                               ent->name[0] = 0xE5;
                        return ent->name;
                }
        }