summaryrefslogtreecommitdiffstats
path: root/src/ntfs.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2007-12-06 00:35:01 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2007-12-06 00:35:01 +0100
commit54de8ce209520ec5d486d754d2e54471f0e4b0e8 (patch)
tree57dd77d27485749a00919e2a47805d490c4be39e /src/ntfs.c
parent56e807748e6e8ee7e924834fc2516d4e63dbca3c (diff)
Avoid malloc(0) in NTFS code
Diffstat (limited to 'src/ntfs.c')
-rw-r--r--src/ntfs.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ntfs.c b/src/ntfs.c
index e868b49..8b6be40 100644
--- a/src/ntfs.c
+++ b/src/ntfs.c
@@ -409,6 +409,11 @@ static int ntfs_read_MFT(disk_t *disk_car, partition_t *partition, const struct
log_debug("NTFS MFT_record_size = %u\n",mft_record_size);
log_debug("NTFS sector size= %u\n", ntfs_sector_size(ntfs_header));
#endif
+ if(mft_size==0)
+ {
+ log_error("Invalid MFT record size or NTFS sector size\n");
+ return 1;
+ }
buffer=(unsigned char *)MALLOC(mft_size);
if(disk_car->read(disk_car,mft_size, buffer, mft_pos)!=0)
{