summaryrefslogtreecommitdiffstats
path: root/src/file_zip.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2016-09-30 16:08:34 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2016-09-30 16:08:34 +0200
commit1b8ec405730376ace620cc39fe534006cf648b55 (patch)
tree9d5713e2280734aa74522a703dd79a1a8381ac19 /src/file_zip.c
parent05f8db763826fdd8771a82a34600704ba7390801 (diff)
header_ignored_adv(): generalized the speed optimization created for zip file
in commit b947e58fa0a049692202e04d14992d5d829d5356
Diffstat (limited to 'src/file_zip.c')
-rw-r--r--src/file_zip.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/file_zip.c b/src/file_zip.c
index 539ec2b..d449d11 100644
--- a/src/file_zip.c
+++ b/src/file_zip.c
@@ -784,8 +784,8 @@ static int header_check_zip(const unsigned char *buffer, const unsigned int buff
if(file_recovery->file_stat!=NULL &&
file_recovery->file_stat->file_hint==&file_hint_doc)
{
- header_ignored(file_recovery_new);
- return 0;
+ if(header_ignored_adv(file_recovery, file_recovery_new)==0)
+ return 0;
}
/* A zip file begins by ZIP_FILE_ENTRY, this signature can also be
* found for each compressed file */
@@ -793,22 +793,8 @@ static int header_check_zip(const unsigned char *buffer, const unsigned int buff
file_recovery->file_stat->file_hint==&file_hint_zip &&
safe_header_only==0)
{
- file_recovery_t fr_test;
- off_t offset;
- memcpy(&fr_test, file_recovery, sizeof(fr_test));
-#ifdef HAVE_FTELLO
- if((offset=ftello(file_recovery->handle)) == -1)
- offset=ftell(file_recovery->handle);
-#else
- offset=ftell(file_recovery->handle);
-#endif
- file_check_zip(&fr_test);
- fseek(file_recovery->handle, offset, SEEK_SET);
- if(fr_test.file_size==0)
- {
- header_ignored(file_recovery_new);
+ if(header_ignored_adv(file_recovery, file_recovery_new)==0)
return 0;
- }
}
reset_file_recovery(file_recovery_new);
file_recovery_new->min_filesize=21;