[misc] use %S to print wchar_t strings where possible

* Also fix some Coverity warnings
This commit is contained in:
Pete Batard 2019-01-03 12:29:28 +00:00
parent 5309dc88e2
commit befe2606cf
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
5 changed files with 17 additions and 27 deletions

View file

@ -405,6 +405,8 @@ static PWSTR GetProcessCommandLine(HANDLE hProcess)
goto out;
ucmdline = (UNICODE_STRING*)(pp + cmd_offset);
// In the absolute, someone could craft a process with dodgy attributes to try to cause an overflow
ucmdline->Length = min(ucmdline->Length, 512);
wcmdline = (PWSTR)calloc(ucmdline->Length + 1, sizeof(WCHAR));
if (!ReadProcessMemory(hProcess, ucmdline->Buffer, wcmdline, ucmdline->Length, NULL)) {
safe_free(wcmdline);
@ -433,7 +435,7 @@ static DWORD WINAPI SearchProcessThread(LPVOID param)
WCHAR *wHandleName = NULL;
HANDLE dupHandle = NULL;
HANDLE processHandle = NULL;
BOOLEAN bFound = FALSE, bGotCmdLine, verbose = !_bQuiet;
BOOLEAN bFound = FALSE, bGotCmdLine = FALSE, verbose = !_bQuiet;
ULONG access_rights = 0;
DWORD size;
char cmdline[MAX_PATH] = { 0 };