Skip to content

Commit f35b311

Browse files
authored
Merge pull request #48 from bb107/relocation
base relocation
2 parents 61a80f4 + 252e628 commit f35b311

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

MemoryModule/MemoryModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ NTSTATUS MemoryLoadLibrary(
285285
PIMAGE_BASE_RELOCATION_HEADER relocation = (PIMAGE_BASE_RELOCATION_HEADER)(LPBYTE(base) + dir->VirtualAddress);
286286

287287
if (dir->Size && dir->VirtualAddress) {
288-
while (relocation->VirtualAddress > 0) {
288+
while ((LPBYTE(relocation) < LPBYTE(base) + dir->VirtualAddress + dir->Size) && relocation->VirtualAddress > 0) {
289289
auto relInfo = (_REBASE_INFO*)&relocation->TypeOffset;
290290
for (DWORD i = 0; i < relocation->TypeOffsetCount(); ++i, ++relInfo) {
291291
switch (relInfo->Type) {

0 commit comments

Comments
 (0)