FIx typo
This commit is contained in:
parent
6002ddc4ad
commit
0a94e0aa5b
2 changed files with 12 additions and 8 deletions
|
|
@ -12,7 +12,7 @@ int get_uncompressed_size(zip zip)
|
||||||
for (int i = 0; i < zip.entries; i++)
|
for (int i = 0; i < zip.entries; i++)
|
||||||
{
|
{
|
||||||
unsigned int file_size =
|
unsigned int file_size =
|
||||||
((LFH*) zip.start + zip.lfh_off[i])->uncompressed_size;
|
((LFH*) (zip.start + zip.lfh_off[i]))->uncompressed_size;
|
||||||
|
|
||||||
if (size > MAX_INT / 2 && file_size > MAX_INT / 2)
|
if (size > MAX_INT / 2 && file_size > MAX_INT / 2)
|
||||||
{
|
{
|
||||||
|
|
@ -32,7 +32,7 @@ bool detect_overlaps(zip zip)
|
||||||
|
|
||||||
for (int i = 0; i < zip.entries - 1; i++)
|
for (int i = 0; i < zip.entries - 1; i++)
|
||||||
{
|
{
|
||||||
LFH* lfh = (LFH*) zip.start + zip.lfh_off[i];
|
LFH* lfh = (LFH*) (zip.start + zip.lfh_off[i]);
|
||||||
unsigned int lf_size = sizeof(LFH) + lfh->filename_length +
|
unsigned int lf_size = sizeof(LFH) + lfh->filename_length +
|
||||||
lfh->extraf_length + lfh->compressed_size;
|
lfh->extraf_length + lfh->compressed_size;
|
||||||
|
|
||||||
|
|
@ -60,12 +60,13 @@ bool scan_decoded_files(zip zip)
|
||||||
if (lfh->filename_length != zip.cdh_filename_length[i])
|
if (lfh->filename_length != zip.cdh_filename_length[i])
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[ERROR] Mismatch in CDH/LFH filename lengths.\n");
|
fprintf(stderr, "[ERROR] Mismatch in CDH/LFH filename lengths.\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean decoded struct and decode block if possible
|
// Clean decoded struct and decode block if possible
|
||||||
decoded->buffer = decoded->clean = decoded->size = 0;
|
decoded->buffer = decoded->clean = decoded->size = 0;
|
||||||
|
|
||||||
|
// Stored block
|
||||||
if (lfh->compression_method == COMP_NONE)
|
if (lfh->compression_method == COMP_NONE)
|
||||||
{
|
{
|
||||||
printf("[FILE %d] Scanning stored data...\n", i);
|
printf("[FILE %d] Scanning stored data...\n", i);
|
||||||
|
|
@ -87,6 +88,7 @@ bool scan_decoded_files(zip zip)
|
||||||
memcpy(decoded->buffer, block, decoded->size);
|
memcpy(decoded->buffer, block, decoded->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deflate compression
|
||||||
else if (lfh->compression_method == COMP_DEFLATE)
|
else if (lfh->compression_method == COMP_DEFLATE)
|
||||||
{
|
{
|
||||||
printf("[FILE %d] Scanning first block of DEFLATED data...\n", i);
|
printf("[FILE %d] Scanning first block of DEFLATED data...\n", i);
|
||||||
|
|
@ -180,10 +182,9 @@ bool scan_decoded_files(zip zip)
|
||||||
{
|
{
|
||||||
decoded->clean(decoded->buffer);
|
decoded->clean(decoded->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(decoded);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(decoded);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,8 @@ void get_eocd(zip* z)
|
||||||
|
|
||||||
if (!z->lfh_off || !z->cdh_filename_length)
|
if (!z->lfh_off || !z->cdh_filename_length)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(
|
||||||
|
stderr,
|
||||||
"[ERROR] Failed to allocate CDH/LFH buffer for %d entries\n",
|
"[ERROR] Failed to allocate CDH/LFH buffer for %d entries\n",
|
||||||
z->entries);
|
z->entries);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
@ -87,7 +88,8 @@ char* decode_type1_block_vuln(bitstream* bs, char* decoded_data)
|
||||||
|
|
||||||
if ((token = next_token(bs, tr_dist)) == END_OF_BLOCK)
|
if ((token = next_token(bs, tr_dist)) == END_OF_BLOCK)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[ERROR] Got EndOfBlock when decoding distance token\n");
|
fprintf(
|
||||||
|
stderr, "[ERROR] Got EndOfBlock when decoding distance token\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,7 +129,8 @@ char* decode_type1_block_v2(
|
||||||
|
|
||||||
if ((token = next_token(bs, tr_dist)) == END_OF_BLOCK)
|
if ((token = next_token(bs, tr_dist)) == END_OF_BLOCK)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[ERROR] Got EndOfBlock when decoding distance token\n");
|
fprintf(
|
||||||
|
stderr, "[ERROR] Got EndOfBlock when decoding distance token\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue