From 6dca6fe432cdd3659973f688ca066c7698149beb Mon Sep 17 00:00:00 2001 From: fzielcke Date: Mon, 9 Feb 2009 14:17:19 +0000 Subject: [PATCH] 2009-02-09 Felix Zielcke fs/fat.c (grub_fat_mount): Try to avoid false positives by checking bpb.version_specific.fat12_or_fat16.fstype and bpb.version_specific.fat32.fstype. --- ChangeLog | 6 ++++++ fs/fat.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index 440f2cebc..9dd5df219 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-02-09 Felix Zielcke + + fs/fat.c (grub_fat_mount): Try to avoid false positives by checking + bpb.version_specific.fat12_or_fat16.fstype and + bpb.version_specific.fat32.fstype. + 2009-02-08 Robert Millan * fs/tar.c: Replace "fs/cpio.c" with "cpio.c". diff --git a/fs/fat.c b/fs/fat.c index d62adbc27..6b39ef0f6 100644 --- a/fs/fat.c +++ b/fs/fat.c @@ -187,6 +187,11 @@ grub_fat_mount (grub_disk_t disk) if (grub_disk_read (disk, 0, 0, sizeof (bpb), (char *) &bpb)) goto fail; + if (! grub_strncmp((const char *) bpb.version_specific.fat12_or_fat16.fstype, "FAT12",5) + || ! grub_strncmp((const char *) bpb.version_specific.fat12_or_fat16.fstype, "FAT16",5) + || ! grub_strncmp((const char *) bpb.version_specific.fat32.fstype, "FAT32",5)) + goto fail; + /* Get the sizes of logical sectors and clusters. */ data->logical_sector_bits = fat_log2 (grub_le_to_cpu16 (bpb.bytes_per_sector));