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

PeFile::rebuildImports(): Allow strlen() up to the very end of a logical block

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=65650
https://github.com/upx/upx/issues/769
	modified:   pefile.cpp
This commit is contained in:
John Reiser 2024-01-11 09:57:57 -08:00 committed by Markus F.X.J. Oberhumer
parent e4a611bcae
commit 2ad0d51226

View File

@ -2948,10 +2948,12 @@ void PeFile::unpack0(OutputFile *fo, const ht &ih, ht &oh, ord_mask_t ord_mask,
if (iobjs > 2) {
// read the noncompressed section
unsigned const size = isection[2].size;
ibuf.dealloc();
ibuf.alloc(isection[2].size);
ibuf.alloc(size + 1);
fi->seek(isection[2].rawdataptr, SEEK_SET);
fi->readx(ibuf, ibufgood = isection[2].size);
fi->readx(ibuf, ibufgood = size);
ibuf[size] = 0; // allow strlen() up to 'size'
}
// unfilter