git-svn: trunk@3105
aCaB authored on 2007/06/21 01:53:08... | ... |
@@ -326,7 +326,7 @@ int unaspack212(uint8_t *image, unsigned int size, struct cli_exe_section *secti |
326 | 326 |
struct ASPK stream; |
327 | 327 |
uint32_t i=0, j=0; |
328 | 328 |
uint8_t *blocks = image+ep+0x57c, *wrkbuf; |
329 |
- uint32_t block_rva = 0, block_size; |
|
329 |
+ uint32_t block_rva = 1, block_size; |
|
330 | 330 |
struct cli_exe_section *outsects; |
331 | 331 |
|
332 | 332 |
if (!(wrkbuf = cli_calloc(0x1800, sizeof(uint8_t)))) { |
... | ... |
@@ -352,11 +352,11 @@ int unaspack212(uint8_t *image, unsigned int size, struct cli_exe_section *secti |
352 | 352 |
|
353 | 353 |
i=0; |
354 | 354 |
while (CLI_ISCONTAINED(image, size, blocks, 8) && (block_rva = cli_readint32(blocks)) && (block_size = cli_readint32(blocks+4)) && CLI_ISCONTAINED(image, size, image+block_rva, block_size)) { |
355 |
- wrkbuf = (uint8_t *)cli_malloc(block_size); |
|
355 |
+ wrkbuf = (uint8_t *)cli_calloc(block_size+0x10e, sizeof(uint8_t)); |
|
356 | 356 |
if (!wrkbuf) break; |
357 | 357 |
|
358 | 358 |
stream.input = wrkbuf; |
359 |
- stream.iend = &wrkbuf[block_size]; |
|
359 |
+ stream.iend = &wrkbuf[block_size+0x10e]; |
|
360 | 360 |
|
361 | 361 |
memcpy(wrkbuf, image + block_rva, block_size); |
362 | 362 |
|
... | ... |
@@ -405,7 +405,7 @@ int unaspack212(uint8_t *image, unsigned int size, struct cli_exe_section *secti |
405 | 405 |
outsects[i].raw=outsects[i].rva; |
406 | 406 |
outsects[i].rsz=outsects[i].vsz; |
407 | 407 |
} |
408 |
- if (!cli_rebuildpe((char *)image, outsects, sectcount, base, cli_readint32(image + ep + 0x279), 0, 0, f)) { |
|
408 |
+ if (!cli_rebuildpe((char *)image, outsects, sectcount, base, cli_readint32(image + ep + 0x39b), 0, 0, f)) { |
|
409 | 409 |
cli_dbgmsg("Aspack: rebuild failed\n"); |
410 | 410 |
cli_writen(f, image, size); |
411 | 411 |
} else { |