Detect and handle invalid number of FATs
If the number of FATs field in the boot sector is zero, give
an appropriate error code.
Change-Id: I56545fb322a9d4c94aea8ddbd4879701617100e4
Signed-off-by: Sebastian Rasmussen <sebastian.rasmussen@stericsson.com>
Signed-off-by: Christian Bejram <christian.bejram@stericsson.com>
diff --git a/boot.c b/boot.c
index 6e797fd..52bf011 100644
--- a/boot.c
+++ b/boot.c
@@ -205,6 +205,10 @@
pfatal("Invalid sector size: %u", boot->BytesPerSec);
return FSFATAL;
}
+ if (boot->FATs == 0) {
+ pfatal("Invalid number of FATs: %u", boot->FATs);
+ return FSFATAL;
+ }
if (boot->Sectors) {
boot->HugeSectors = 0;
boot->NumSectors = boot->Sectors;