summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-11-01 16:04:19 +0000
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-11-01 16:04:19 +0000
commitd10e31b579d487e459183cbc004e844a8de20379 (patch)
tree488fa6253f8375fc8271b9e18234ad708b4a5a24
parent437424c4f16a30e306a936854fac2032f072a271 (diff)
parentc0a43e474789a92f91930a1c875eb7ce48e335c8 (diff)
downloadandroid_external_fsck_msdos-shipping/cm-11.0.tar.gz
android_external_fsck_msdos-shipping/cm-11.0.tar.bz2
android_external_fsck_msdos-shipping/cm-11.0.zip
Android 4.4 Release 1.0
-rw-r--r--boot.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/boot.c b/boot.c
index 52bf011..5326a45 100644
--- a/boot.c
+++ b/boot.c
@@ -106,6 +106,25 @@ readboot(dosfs, boot)
boot->FSInfo = block[48] + (block[49] << 8);
boot->Backup = block[50] + (block[51] << 8);
+ /* If the OEM Name field is EXFAT, it's not FAT32, so bail */
+ if (!memcmp(&block[3], "EXFAT ", 8)) {
+ pfatal("exFAT filesystem is not supported.");
+ return FSFATAL;
+ }
+
+ /* check basic parameters */
+ if ((boot->FSInfo == 0) ||
+ (boot->BytesPerSec % DOSBOOTBLOCKSIZE != 0) ||
+ (boot->BytesPerSec / DOSBOOTBLOCKSIZE == 0) ||
+ (boot->SecPerClust == 0)) {
+ /*
+ * Either the BIOS Parameter Block has been corrupted,
+ * or this is not a FAT32 filesystem, most likely an
+ * exFAT filesystem.
+ */
+ pfatal("Invalid FAT32 Extended BIOS Parameter Block");
+ return FSFATAL;
+ }
if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET)
!= boot->FSInfo * boot->BytesPerSec
|| read(dosfs, fsinfo, sizeof fsinfo)