summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2018-03-15 10:10:22 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2018-03-15 10:10:22 +0100
commitf29f7ab54cbb930dbd551eed92cf78af30f9abf3 (patch)
treebf7c203122425dce3dbb9c249a0ae9b7e267da02
parentf3bdb0f39cc38916ed25e3fec0739e2d15193cfe (diff)
Fix various warnings
-rw-r--r--src/exfat.c2
-rw-r--r--src/file_mkv.c2
-rw-r--r--src/misc.c2
-rw-r--r--src/partgpt.c3
-rw-r--r--src/parti386.c46
-rw-r--r--src/partsun.c3
6 files changed, 32 insertions, 26 deletions
diff --git a/src/exfat.c b/src/exfat.c
index 8d6d28d..dac6e74 100644
--- a/src/exfat.c
+++ b/src/exfat.c
@@ -105,7 +105,7 @@ int recover_exFAT(const disk_t *disk, const struct exfat_super_block *exfat_head
#endif
if((le64(exfat_header->start_sector) * disk ->sector_size +
(12 << exfat_header->blocksize_bits) == partition->part_offset) ||
- (disk->arch==&arch_none && (12 << exfat_header->blocksize_bits) == partition->part_offset))
+ (disk->arch==&arch_none && ((uint64_t)12 << exfat_header->blocksize_bits) == partition->part_offset))
{
partition->sb_offset=12 << exfat_header->blocksize_bits;
partition->part_offset-=partition->sb_offset;
diff --git a/src/file_mkv.c b/src/file_mkv.c
index 7d115a4..be34cda 100644
--- a/src/file_mkv.c
+++ b/src/file_mkv.c
@@ -153,7 +153,7 @@ static int header_check_mkv(const unsigned char *buffer, const unsigned int buff
return 0;
segment_data_offset=segment_offset+sizeof(EBML_Segment)+len;
/* Check if size is unkown */
- if(segment_size == (1LL << (7 * len)) - 1)
+ if(segment_size == (1ULL << (7 * len)) - 1)
segment_size=0;
#ifdef DEBUG_MKV
log_info("segment_data_offset %llu\n", (long long unsigned) segment_data_offset);
diff --git a/src/misc.c b/src/misc.c
index 0fb5f56..8ac00d6 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -177,7 +177,7 @@ https://msdn.microsoft.com/en-us/library/windows/desktop/ms724834%28v=vs.85%29.a
struct utsname Ver;
if(uname(&Ver)==0)
{
- static char buffer[100] = {0x00};
+ static char buffer[512] = {0x00};
snprintf(buffer, sizeof(buffer) - 1, "%s, kernel %s (%s) %s",
Ver.sysname, Ver.release, Ver.version, Ver.machine);
return buffer;
diff --git a/src/partgpt.c b/src/partgpt.c
index f4e7d10..4947f57 100644
--- a/src/partgpt.c
+++ b/src/partgpt.c
@@ -336,8 +336,9 @@ static list_part_t *init_part_order_gpt(const disk_t *disk_car, list_part_t *lis
list_part_t *add_partition_gpt_cli(disk_t *disk_car,list_part_t *list_part, char **current_cmd)
{
+ partition_t *new_partition;
assert(current_cmd!=NULL);
- partition_t *new_partition=partition_new(&arch_gpt);
+ new_partition=partition_new(&arch_gpt);
new_partition->part_offset=disk_car->sector_size;
new_partition->part_size=disk_car->disk_size-new_partition->part_offset;
while(*current_cmd[0]==',')
diff --git a/src/parti386.c b/src/parti386.c
index a0662d9..211686e 100644
--- a/src/parti386.c
+++ b/src/parti386.c
@@ -376,34 +376,34 @@ static list_part_t *read_part_i386(disk_t *disk_car, const int verbose, const in
for(i=0;i<4;i++)
{
const struct partition_dos *p=pt_offset(buffer,i);
- status_type_t status=STATUS_PRIM;
+ status_type_t status;
switch(p->sys_ind)
{
- case P_NO_OS:
- break;
case P_EXTENDX:
case P_EXTENDED:
case P_LINUXEXTENDX:
status=STATUS_EXT;
- /* don't put a break */
+ break;
default:
- {
- int insert_error=0;
- partition_t *new_partition=partition_new(&arch_i386);
- i386_entry2partition(disk_car, (uint64_t)0, new_partition, p, status,i+1,verbose,saveheader);
- if(verbose>1)
- log_dos_entry(p);
- aff_part_buffer(AFF_PART_ORDER|AFF_PART_STATUS,disk_car,new_partition);
- if(new_partition->errcode!=BAD_NOERR)
- {
- screen_buffer_add("%s\n",errmsg_i386_entry2partition(new_partition->errcode));
- }
- new_list_part=insert_new_partition(new_list_part,new_partition, 0, &insert_error);
- if(insert_error>0)
- free(new_partition);
- }
+ status=STATUS_PRIM;
break;
}
+ if(p->sys_ind != P_NO_OS)
+ {
+ int insert_error=0;
+ partition_t *new_partition=partition_new(&arch_i386);
+ i386_entry2partition(disk_car, (uint64_t)0, new_partition, p, status,i+1,verbose,saveheader);
+ if(verbose>1)
+ log_dos_entry(p);
+ aff_part_buffer(AFF_PART_ORDER|AFF_PART_STATUS,disk_car,new_partition);
+ if(new_partition->errcode!=BAD_NOERR)
+ {
+ screen_buffer_add("%s\n",errmsg_i386_entry2partition(new_partition->errcode));
+ }
+ new_list_part=insert_new_partition(new_list_part,new_partition, 0, &insert_error);
+ if(insert_error>0)
+ free(new_partition);
+ }
}
test_MBR_data(new_list_part);
test_MBR_over(disk_car,new_list_part);
@@ -422,9 +422,10 @@ static void test_MBR_data(list_part_t *list_part)
const partition_t *partition=element->part;
switch(partition->status)
{
- case STATUS_PRIM_BOOT:
- nb_boot++;
case STATUS_PRIM:
+ case STATUS_PRIM_BOOT:
+ if(partition->status == STATUS_PRIM_BOOT)
+ nb_boot++;
switch(partition->part_type_i386)
{
case P_12FAT:
@@ -1195,6 +1196,9 @@ static int test_structure_i386(list_part_t *list_part)
case STATUS_PRIM_BOOT:
if(nbr_prim_boot++)
return 1;
+ nbr_prim++;
+ first_log=NULL;
+ break;
case STATUS_PRIM:
nbr_prim++;
first_log=NULL;
diff --git a/src/partsun.c b/src/partsun.c
index 1bf80c9..1c2e4c8 100644
--- a/src/partsun.c
+++ b/src/partsun.c
@@ -219,8 +219,9 @@ static list_part_t *init_part_order_sun(const disk_t *disk_car, list_part_t *lis
list_part_t *add_partition_sun_cli(disk_t *disk_car,list_part_t *list_part, char **current_cmd)
{
CHS_t start,end;
+ partition_t *new_partition;
assert(current_cmd!=NULL);
- partition_t *new_partition=partition_new(&arch_sun);
+ new_partition=partition_new(&arch_sun);
start.cylinder=0;
start.head=0;
start.sector=1;