mirror of https://github.com/n1nj4sec/pupy.git
client/windows: do not fail in buffer exhaused
This commit is contained in:
parent
23165e6ff6
commit
18aeb3a12a
|
@ -110,13 +110,16 @@ LPSTR* CommandLineToArgvA(INT *pNumArgs)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bufLen = storage - numArgs * sizeof(LPSTR);
|
bufLen = storage - (numArgs * sizeof(LPSTR));
|
||||||
buffer = ((LPSTR)result) + numArgs * sizeof(LPSTR);
|
buffer = ((LPSTR)result) + (numArgs * sizeof(LPSTR));
|
||||||
for (i = 0; i < numArgs; ++ i)
|
for (i = 0; i < numArgs; ++ i)
|
||||||
{
|
{
|
||||||
BOOL lpUsedDefaultChar = FALSE;
|
BOOL lpUsedDefaultChar = FALSE;
|
||||||
|
|
||||||
assert(bufLen > 0);
|
if (bufLen < 0) {
|
||||||
|
dprint("Buflen exhaused, arg %d (%d/%d)\n", i, bufLen, storage);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
retval = WideCharToMultiByte(
|
retval = WideCharToMultiByte(
|
||||||
CP_UTF8, 0, args[i], -1, buffer,
|
CP_UTF8, 0, args[i], -1, buffer,
|
||||||
|
|
Loading…
Reference in New Issue