mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 01:35:43 +00:00
- GetConsoleAliasW: Check for invalid target buffer, failed memory allocation + set last error
svn path=/trunk/; revision=42765
This commit is contained in:
parent
9f218a3f22
commit
d2fa38f67a
1 changed files with 12 additions and 0 deletions
|
@ -352,6 +352,12 @@ GetConsoleAliasW(LPWSTR lpSource,
|
||||||
|
|
||||||
DPRINT("GetConsoleAliasW entered lpSource %S lpExeName %S\n", lpSource, lpExeName);
|
DPRINT("GetConsoleAliasW entered lpSource %S lpExeName %S\n", lpSource, lpExeName);
|
||||||
|
|
||||||
|
if (lpTargetBuffer == NULL)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
CsrRequest = MAKE_CSR_API(GET_CONSOLE_ALIAS, CSR_CONSOLE);
|
CsrRequest = MAKE_CSR_API(GET_CONSOLE_ALIAS, CSR_CONSOLE);
|
||||||
|
|
||||||
ExeLength = wcslen(lpExeName) + 1;
|
ExeLength = wcslen(lpExeName) + 1;
|
||||||
|
@ -361,11 +367,17 @@ GetConsoleAliasW(LPWSTR lpSource,
|
||||||
|
|
||||||
RequestLength = Size + sizeof(CSR_API_MESSAGE);
|
RequestLength = Size + sizeof(CSR_API_MESSAGE);
|
||||||
Request = RtlAllocateHeap(GetProcessHeap(), 0, RequestLength);
|
Request = RtlAllocateHeap(GetProcessHeap(), 0, RequestLength);
|
||||||
|
if (Request == NULL)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
CaptureBuffer = CsrAllocateCaptureBuffer(1, TargetBufferLength);
|
CaptureBuffer = CsrAllocateCaptureBuffer(1, TargetBufferLength);
|
||||||
if (!CaptureBuffer)
|
if (!CaptureBuffer)
|
||||||
{
|
{
|
||||||
RtlFreeHeap(GetProcessHeap(), 0, Request);
|
RtlFreeHeap(GetProcessHeap(), 0, Request);
|
||||||
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue