[rtems commit] dosfs: Ensure valid data cluster count
Sebastian Huber
sebh at rtems.org
Fri Feb 15 16:08:44 UTC 2013
Module: rtems
Branch: master
Commit: 0c9b35e8dd1837ece019318a9ea9199e970e74a1
Changeset: http://git.rtems.org/rtems/commit/?id=0c9b35e8dd1837ece019318a9ea9199e970e74a1
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Feb 15 16:52:05 2013 +0100
dosfs: Ensure valid data cluster count
---
cpukit/libfs/src/dosfs/fat.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/cpukit/libfs/src/dosfs/fat.c b/cpukit/libfs/src/dosfs/fat.c
index 8e9da21..b2b55c0 100644
--- a/cpukit/libfs/src/dosfs/fat.c
+++ b/cpukit/libfs/src/dosfs/fat.c
@@ -652,12 +652,17 @@ fat_init_volume_info(fat_fs_info_t *fs_info, const char *device)
vol->mask = FAT_FAT16_MASK;
vol->eoc_val = FAT_FAT16_EOC;
}
- else
+ else if ( vol->data_cls < FAT_FAT32_MASK - 1 )
{
vol->type = FAT_FAT32;
vol->mask = FAT_FAT32_MASK;
vol->eoc_val = FAT_FAT32_EOC;
}
+ else
+ {
+ close(vol->fd);
+ rtems_set_errno_and_return_minus_one( EINVAL );
+ }
}
if (vol->type == FAT_FAT32)
More information about the vc
mailing list