Scan zip for multiple threats

This commit is contained in:
atxr 2024-02-23 18:02:03 +01:00
parent a38b5d4ec4
commit 88becd6097
4 changed files with 168 additions and 37 deletions

View file

@ -6,7 +6,25 @@
#include "libmineziper_huffman_tree.h"
#include "libmineziper_zip.h"
int get_uncompressed_size(zip* in);
#define MAX_UNCOMPRESSED_SIZE 0x10000000
#define MAX_INT 0xffffffff
typedef struct data
{
unsigned int size;
void (*clean)(void*);
char* buffer;
} data;
int get_uncompressed_size(zip zip);
bool detect_overlaps(zip zip);
bool scan_decoded_files(zip zip);
bool scan_zip(char* zip_data, int zip_size);
static const char* sigs[] = {
"\x7f"
"ELF",
"MZ"};
static const int sigs_size = sizeof(sigs) / sizeof(char*);
#endif

View file

@ -9,7 +9,8 @@
#define EOCD_SIG "PK\05\06"
#define LFH_SIG "PK\03\04"
#define CDH_SIG "PK\01\02"
#define DEFLATE 8
#define COMP_NONE 0
#define COMP_DEFLATE 8
#define END_OF_BLOCK 256