summaryrefslogtreecommitdiffstats
path: root/src/hdaccess.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-11-15 12:45:31 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2014-11-15 12:45:31 +0100
commit34f51c2c65ee02c943e25ce765c23b0da07a712d (patch)
tree3a679f3c51b136194673fc2fc8c59f409d3bca9c /src/hdaccess.c
parent7ce8355907083363f914eab630bd083832604bf7 (diff)
Stricter check for .E01 when used as disk image
Diffstat (limited to 'src/hdaccess.c')
-rw-r--r--src/hdaccess.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/hdaccess.c b/src/hdaccess.c
index 8e7799a..878adf5 100644
--- a/src/hdaccess.c
+++ b/src/hdaccess.c
@@ -1507,11 +1507,13 @@ disk_t *file_test_availability(const char *device, const int verbose, int testdi
#endif
{
unsigned char *buffer;
+ const struct tdewf_file_header *ewf;
const uint8_t evf_file_signature[8] = { 'E', 'V', 'F', 0x09, 0x0D, 0x0A, 0xFF, 0x00 };
if(verbose>1)
log_verbose("file_test_availability %s is a file\n", device);
disk_car->sector_size=DEFAULT_SECTOR_SIZE;
buffer=(unsigned char*)MALLOC(DEFAULT_SECTOR_SIZE);
+ ewf=(const struct tdewf_file_header *)buffer;
if(read(hd_h,buffer,DEFAULT_SECTOR_SIZE)<0)
{
memset(buffer,0,DEFAULT_SECTOR_SIZE);
@@ -1525,7 +1527,7 @@ disk_t *file_test_availability(const char *device, const int verbose, int testdi
disk_car->disk_real_size=(uint64_t)disk_car->geom.cylinders * disk_car->geom.heads_per_cylinder * disk_car->geom.sectors_per_head * disk_car->sector_size;
disk_car->offset=*(unsigned long*)(buffer+19);
}
- else if(memcmp(buffer, evf_file_signature, 8)==0)
+ else if(memcmp(buffer, evf_file_signature, 8)==0 && le16(ewf->fields_segment)==1)
{
free(buffer);
free(data);