mirror of
https://github.com/Nightmare-Eclipse/BlueHammer.git
synced 2026-05-26 13:30:50 +00:00
Fix handle leak, dangling handle, and UnlockFile bugs
- Fix cleanup block checking hint instead of hint2 before closing - Fix hint2 not being set to NULL after InternetCloseHandle - Replace UnlockFile(NULL params) with UnlockFileEx matching LockFileEx params
This commit is contained in:
parent
48f6a48094
commit
858af55117
1 changed files with 4 additions and 4 deletions
|
|
@ -685,7 +685,7 @@ UpdateFiles* GetUpdateFiles(int* filecount = NULL)
|
||||||
InternetCloseHandle(hint);
|
InternetCloseHandle(hint);
|
||||||
hint = NULL;
|
hint = NULL;
|
||||||
InternetCloseHandle(hint2);
|
InternetCloseHandle(hint2);
|
||||||
hint = NULL;
|
hint2 = NULL;
|
||||||
printf("Done.\n");
|
printf("Done.\n");
|
||||||
mappedbuff = GetCabFileFromBuff((PIMAGE_DOS_HEADER)exebuff, sz, &ressz);
|
mappedbuff = GetCabFileFromBuff((PIMAGE_DOS_HEADER)exebuff, sz, &ressz);
|
||||||
|
|
||||||
|
|
@ -3318,7 +3318,7 @@ int wmain(int argc, wchar_t* argv[])
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnlockFile(hleakedfile, NULL, NULL, NULL, NULL);
|
UnlockFileEx(hleakedfile, 0, _filesz.LowPart, _filesz.HighPart, &ovd2);
|
||||||
filelocked = false;
|
filelocked = false;
|
||||||
CloseHandle(hleakedfile);
|
CloseHandle(hleakedfile);
|
||||||
printf("Read %d bytes\n", __readsz);
|
printf("Read %d bytes\n", __readsz);
|
||||||
|
|
@ -3377,7 +3377,7 @@ cleanup:
|
||||||
|
|
||||||
if(hint)
|
if(hint)
|
||||||
InternetCloseHandle(hint);
|
InternetCloseHandle(hint);
|
||||||
if(hint)
|
if(hint2)
|
||||||
InternetCloseHandle(hint2);
|
InternetCloseHandle(hint2);
|
||||||
if (exebuff)
|
if (exebuff)
|
||||||
free(exebuff);
|
free(exebuff);
|
||||||
|
|
@ -3407,7 +3407,7 @@ cleanup:
|
||||||
if (hleakedfile)
|
if (hleakedfile)
|
||||||
{
|
{
|
||||||
if (filelocked)
|
if (filelocked)
|
||||||
UnlockFile(hleakedfile, NULL, NULL, NULL, NULL);
|
UnlockFileEx(hleakedfile, 0, _filesz.LowPart, _filesz.HighPart, &ovd2);
|
||||||
CloseHandle(hleakedfile);
|
CloseHandle(hleakedfile);
|
||||||
}
|
}
|
||||||
if (leakedfilebuff)
|
if (leakedfilebuff)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue