mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
Copying the string in NtUserDefSetText () must be protected with SEH, probing alone is not sufficient.
svn path=/trunk/; revision=38572
This commit is contained in:
parent
bd38886763
commit
84d1b53dbc
1 changed files with 31 additions and 11 deletions
|
@ -4577,12 +4577,21 @@ NtUserDefSetText(HWND hWnd, PUNICODE_STRING WindowText)
|
||||||
{
|
{
|
||||||
ASSERT(Wnd->WindowName.Buffer != NULL);
|
ASSERT(Wnd->WindowName.Buffer != NULL);
|
||||||
|
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
Wnd->WindowName.Length = SafeText.Length;
|
Wnd->WindowName.Length = SafeText.Length;
|
||||||
Wnd->WindowName.Buffer[SafeText.Length / sizeof(WCHAR)] = L'\0';
|
Wnd->WindowName.Buffer[SafeText.Length / sizeof(WCHAR)] = L'\0';
|
||||||
RtlCopyMemory(Wnd->WindowName.Buffer,
|
RtlCopyMemory(Wnd->WindowName.Buffer,
|
||||||
SafeText.Buffer,
|
SafeText.Buffer,
|
||||||
SafeText.Length);
|
SafeText.Length);
|
||||||
}
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
Ret = FALSE;
|
||||||
|
SetLastNtError(_SEH2_GetExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PWCHAR buf;
|
PWCHAR buf;
|
||||||
|
@ -4597,6 +4606,8 @@ NtUserDefSetText(HWND hWnd, PUNICODE_STRING WindowText)
|
||||||
Wnd->WindowName.Buffer = DesktopHeapAlloc(Wnd->pdesktop,
|
Wnd->WindowName.Buffer = DesktopHeapAlloc(Wnd->pdesktop,
|
||||||
SafeText.Length + sizeof(UNICODE_NULL));
|
SafeText.Length + sizeof(UNICODE_NULL));
|
||||||
if (Wnd->WindowName.Buffer != NULL)
|
if (Wnd->WindowName.Buffer != NULL)
|
||||||
|
{
|
||||||
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
Wnd->WindowName.Buffer[SafeText.Length / sizeof(WCHAR)] = L'\0';
|
Wnd->WindowName.Buffer[SafeText.Length / sizeof(WCHAR)] = L'\0';
|
||||||
RtlCopyMemory(Wnd->WindowName.Buffer,
|
RtlCopyMemory(Wnd->WindowName.Buffer,
|
||||||
|
@ -4605,6 +4616,15 @@ NtUserDefSetText(HWND hWnd, PUNICODE_STRING WindowText)
|
||||||
Wnd->WindowName.MaximumLength = SafeText.Length + sizeof(UNICODE_NULL);
|
Wnd->WindowName.MaximumLength = SafeText.Length + sizeof(UNICODE_NULL);
|
||||||
Wnd->WindowName.Length = SafeText.Length;
|
Wnd->WindowName.Length = SafeText.Length;
|
||||||
}
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
Wnd->WindowName.Buffer = NULL;
|
||||||
|
DesktopHeapFree(Wnd->pdesktop, Wnd->WindowName.Buffer);
|
||||||
|
Ret = FALSE;
|
||||||
|
SetLastNtError(_SEH2_GetExceptionCode());
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
|
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
|
|
Loading…
Reference in a new issue