1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

pe: fixed unpack problem in rebuildImports()

This commit is contained in:
László Molnár 2006-06-23 11:17:26 +02:00
parent 28d56bab04
commit d2c36eefc9
2 changed files with 4 additions and 3 deletions

View File

@ -2247,6 +2247,7 @@ void PackArmPe::rebuildImports(upx_byte *& extrainfo)
import_desc *im = im0;
upx_byte *dllnames = Obuf + inamespos;
upx_byte *importednames = dllnames + sdllnames;
upx_byte * const importednames_start = importednames;
for (p = idata; get_le32(p) != 0; ++p)
{
@ -2282,7 +2283,7 @@ void PackArmPe::rebuildImports(upx_byte *& extrainfo)
const unsigned ilen = strlen(++p) + 1;
if (inamespos)
{
if (ptr_diff(importednames,oimpdlls) & 1)
if (ptr_diff(importednames, importednames_start) & 1)
importednames -= 1;
omemcpy(importednames + 2, p, ilen);
//;;;printf(" %s",importednames+2);

View File

@ -2353,6 +2353,7 @@ void PackW32Pe::rebuildImports(upx_byte *& extrainfo)
import_desc *im = im0;
upx_byte *dllnames = Obuf + inamespos;
upx_byte *importednames = dllnames + sdllnames;
upx_byte * const importednames_start = importednames;
for (p = idata; get_le32(p) != 0; ++p)
{
@ -2388,8 +2389,7 @@ void PackW32Pe::rebuildImports(upx_byte *& extrainfo)
const unsigned ilen = strlen(++p) + 1;
if (inamespos)
{
assert(oimpdlls != NULL); // FIXME
if (ptr_diff(importednames,oimpdlls) & 1)
if (ptr_diff(importednames, importednames_start) & 1)
importednames -= 1;
omemcpy(importednames + 2, p, ilen);
//;;;printf(" %s",importednames+2);