diff options
author | Mirko Vogt <mirko-openwrt@nanl.de> | 2020-04-26 01:47:50 +0200 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2020-05-06 08:50:42 +0200 |
commit | cddd902cc165e0af01469d1cb8defd9b1366093f (patch) | |
tree | f22d8067ba190fa4c9e032b9b03fcbcfa284fcdb | |
parent | 8b9e601160712f74ff46313579d0225a7f90ca3c (diff) | |
download | fstools-cddd902cc165e0af01469d1cb8defd9b1366093f.tar.gz |
Truncate FAT filesystem label until 1st occurance of a blank (0x20)
According to spec the FAT filesystem label is not terminated by a
\0-byte but instead has a fixed length where the name is padded by
blanks.
Before libblkid-tiny just passed the always 11 bytes long blank padded
string through, however it makes matching for a filesystem label
inconsistent with other filesystems, which use a \0-terminated string.
Before: "foobar "
After : "foobar"
Signed-off-by: Mirko Vogt <mirko-openwrt@nanl.de>
-rw-r--r-- | libblkid-tiny/vfat.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libblkid-tiny/vfat.c b/libblkid-tiny/vfat.c index e70dd75..1bce002 100644 --- a/libblkid-tiny/vfat.c +++ b/libblkid-tiny/vfat.c @@ -422,8 +422,10 @@ static int probe_vfat(blkid_probe pr, const struct blkid_idmag *mag) if (boot_label && memcmp(boot_label, no_name, 11)) blkid_probe_set_id_label(pr, "LABEL_FATBOOT", (unsigned char *) boot_label, 11); - if (vol_label) - blkid_probe_set_label(pr, (unsigned char *) vol_label, 11); + if (vol_label) { + strtok((char *) vol_label, " "); + blkid_probe_set_label(pr, (unsigned char *) vol_label, 11); + } /* We can't just print them as %04X, because they are unaligned */ if (vol_serno) |