diff options
author | Dave Chapman <dave@dchapman.com> | 2007-07-09 22:58:08 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2007-07-09 22:58:08 +0000 |
commit | 1c2de0a45e17fbd5af3cab98ad2b1bc70a801d84 (patch) | |
tree | 29f5e0856613718ca2822a63986c4c116760e555 | |
parent | e68255b978ee95297aa312af78d23281a1328006 (diff) | |
download | rockbox-1c2de0a45e17fbd5af3cab98ad2b1bc70a801d84.tar.gz rockbox-1c2de0a45e17fbd5af3cab98ad2b1bc70a801d84.zip |
Prevent another divide-by-zero (only affecting targets with FAT16 support enabled, such as the Sansa).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13837 a1c6a512-1295-4272-9138-f99709370657
-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 */ |