summaryrefslogtreecommitdiffstats
path: root/src/fat_dir.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2008-10-28 09:19:11 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2008-10-28 09:19:11 +0100
commit8a4ace25757626142c7e13c682ddefbe3d88426a (patch)
tree13d06ab3b2a53d6ab47172e6197ccd169f707579 /src/fat_dir.c
parentcdfb7f22cf78c7ca52583b4959793df424337817 (diff)
FAT1x directory listing, check for valid root directory size
Diffstat (limited to 'src/fat_dir.c')
-rw-r--r--src/fat_dir.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/fat_dir.c b/src/fat_dir.c
index 5709b13..77be103 100644
--- a/src/fat_dir.c
+++ b/src/fat_dir.c
@@ -432,7 +432,9 @@ static file_data_t *fat_dir(disk_t *disk_car, const partition_t *partition, dir_
static file_data_t *fat1x_rootdir(disk_t *disk_car, const partition_t *partition, const dir_data_t *dir_data, const struct fat_boot_sector*fat_header)
{
- unsigned int root_size=(get_dir_entries(fat_header)*32+disk_car->sector_size-1)/disk_car->sector_size*disk_car->sector_size;
+ const unsigned int root_size=(get_dir_entries(fat_header)*32+disk_car->sector_size-1)/disk_car->sector_size*disk_car->sector_size;
+ if(root_size==0)
+ return NULL;
if(dir_data->verbose>1)
{
log_trace("fat1x_rootdir root_size=%u sectors\n",root_size/disk_car->sector_size);