diff options
-rw-r--r-- | firmware/drivers/fat.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index 2ca2b6136d..f117119258 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c | |||
@@ -313,6 +313,8 @@ int fat_mount(IF_MV2(int volume,) IF_MV2(int drive,) long startsector) | |||
313 | 313 | ||
314 | #ifdef HAVE_FAT16SUPPORT | 314 | #ifdef HAVE_FAT16SUPPORT |
315 | fat_bpb->bpb_rootentcnt = BYTES2INT16(buf,BPB_ROOTENTCNT); | 315 | fat_bpb->bpb_rootentcnt = BYTES2INT16(buf,BPB_ROOTENTCNT); |
316 | if (!fat_bpb->bpb_bytspersec) | ||
317 | return -2; | ||
316 | rootdirsectors = secmult * ((fat_bpb->bpb_rootentcnt * DIR_ENTRY_SIZE | 318 | rootdirsectors = secmult * ((fat_bpb->bpb_rootentcnt * DIR_ENTRY_SIZE |
317 | + fat_bpb->bpb_bytspersec - 1) / fat_bpb->bpb_bytspersec); | 319 | + fat_bpb->bpb_bytspersec - 1) / fat_bpb->bpb_bytspersec); |
318 | #endif /* #ifdef HAVE_FAT16SUPPORT */ | 320 | #endif /* #ifdef HAVE_FAT16SUPPORT */ |