summaryrefslogtreecommitdiffstats
path: root/src/fatp.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-07-26 22:50:16 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2014-07-26 22:50:16 +0200
commit20942518d5b53680ce461c46a7edb3b2ecbdc38f (patch)
treed78d5160270d1c06c46cb1f7249e7e992f9d0c3d /src/fatp.c
parent132fba09962b72a9a86739b968faaa53f140150d (diff)
Fix potential integer overflow
Diffstat (limited to 'src/fatp.c')
-rw-r--r--src/fatp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/fatp.c b/src/fatp.c
index 64421fe..af33ec3 100644
--- a/src/fatp.c
+++ b/src/fatp.c
@@ -50,7 +50,7 @@ static void fat12_remove_used_space(disk_t *disk,const partition_t *partition, a
log_trace("fat12_remove_used_space\n");
buffer=(unsigned char *)MALLOC(2*sector_size);
del_search_space(list_search_space, partition->part_offset,
- partition->part_offset+(uint64_t)(start_data*sector_size)-1);
+ partition->part_offset + (uint64_t)start_data * sector_size - 1);
for(cluster=2; cluster<=no_of_cluster+1; cluster++)
{
unsigned long int offset_s,offset_o;
@@ -100,7 +100,7 @@ static void fat16_remove_used_space(disk_t *disk_car,const partition_t *partitio
buffer=(unsigned char *)MALLOC(sector_size);
p16=(const uint16_t*)buffer;
del_search_space(list_search_space, partition->part_offset,
- partition->part_offset+(uint64_t)(start_data*sector_size)-1);
+ partition->part_offset + (uint64_t)start_data * sector_size - 1);
for(prev_cluster=2;prev_cluster<=no_of_cluster+1;prev_cluster++)
{
unsigned int offset_o;
@@ -144,7 +144,7 @@ static void fat32_remove_used_space(disk_t *disk_car,const partition_t *partitio
buffer=(unsigned char *)MALLOC(sector_size);
p32=(uint32_t*)buffer;
del_search_space(list_search_space, partition->part_offset,
- partition->part_offset+(uint64_t)(start_data*sector_size)-1);
+ partition->part_offset + (uint64_t)start_data * sector_size - 1);
for(prev_cluster=2;prev_cluster<=no_of_cluster+1;prev_cluster++)
{
unsigned long int cluster;