Browse code

Handle long opt headers in packers

git-svn: trunk@2570

aCaB authored on 2006/12/22 03:19:19
Showing 3 changed files
... ...
@@ -1,3 +1,7 @@
1
+Thu Dec 21 19:16:53 CET 2006 (acab)
2
+-----------------------------------
3
+  * libclamav: Handle long opt headers in packers, just in case...
4
+
1 5
 Wed Dec 20 16:30:49 CET 2006 (acab)
2 6
 -----------------------------------
3 7
   * clamd, libclamav: Fix implicit function declaration
... ...
@@ -124,7 +124,8 @@ char *sudecrypt(int desc, size_t fsize, struct cli_exe_section *sections, uint16
124 124
   hunk[6]=sects&0xff;
125 125
   hunk[7]=sects>>8;
126 126
   cli_writeint32(hunk+0x28, va);
127
-  memset(hunk+0xf8+0x28*sects, 0, 0x28);
127
+  hunk+=0x18+(cli_readint32(hunk+0x14)&0xffff); /* size of PE + size of OPT */
128
+  memset(hunk+0x28*sects, 0, 0x28);
128 129
 
129 130
   return file;
130 131
 }
... ...
@@ -345,7 +345,7 @@ int wwunpack(char *exe, uint32_t exesz, uint32_t headsize, uint32_t min, uint32_
345 345
   cli_writeint32(stuff+0x50, csize);
346 346
 
347 347
 
348
-  stuff+=0xf8;
348
+  stuff+=0x18+(cli_readint32(stuff+0x14)&0xffff);
349 349
   while (sects--) {
350 350
     uint32_t v=cli_readint32(stuff+8);
351 351
     uint32_t r=cli_readint32(stuff+16);