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.zip rockbox-1c2de0a45e17fbd5af3cab98ad2b1bc70a801d84.tar.gz rockbox-1c2de0a45e17fbd5af3cab98ad2b1bc70a801d84.tar.bz2 rockbox-1c2de0a45e17fbd5af3cab98ad2b1bc70a801d84.tar.xz | |
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 2ca2b61..f117119 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) #ifdef HAVE_FAT16SUPPORT fat_bpb->bpb_rootentcnt = BYTES2INT16(buf,BPB_ROOTENTCNT); + if (!fat_bpb->bpb_bytspersec) + return -2; rootdirsectors = secmult * ((fat_bpb->bpb_rootentcnt * DIR_ENTRY_SIZE + fat_bpb->bpb_bytspersec - 1) / fat_bpb->bpb_bytspersec); #endif /* #ifdef HAVE_FAT16SUPPORT */ |