mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +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,11 +4577,20 @@ NtUserDefSetText(HWND hWnd, PUNICODE_STRING WindowText)
|
|||
{
|
||||
ASSERT(Wnd->WindowName.Buffer != NULL);
|
||||
|
||||
Wnd->WindowName.Length = SafeText.Length;
|
||||
Wnd->WindowName.Buffer[SafeText.Length / sizeof(WCHAR)] = L'\0';
|
||||
RtlCopyMemory(Wnd->WindowName.Buffer,
|
||||
SafeText.Buffer,
|
||||
SafeText.Length);
|
||||
_SEH2_TRY
|
||||
{
|
||||
Wnd->WindowName.Length = SafeText.Length;
|
||||
Wnd->WindowName.Buffer[SafeText.Length / sizeof(WCHAR)] = L'\0';
|
||||
RtlCopyMemory(Wnd->WindowName.Buffer,
|
||||
SafeText.Buffer,
|
||||
SafeText.Length);
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
Ret = FALSE;
|
||||
SetLastNtError(_SEH2_GetExceptionCode());
|
||||
}
|
||||
_SEH2_END;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4598,12 +4607,23 @@ NtUserDefSetText(HWND hWnd, PUNICODE_STRING WindowText)
|
|||
SafeText.Length + sizeof(UNICODE_NULL));
|
||||
if (Wnd->WindowName.Buffer != NULL)
|
||||
{
|
||||
Wnd->WindowName.Buffer[SafeText.Length / sizeof(WCHAR)] = L'\0';
|
||||
RtlCopyMemory(Wnd->WindowName.Buffer,
|
||||
SafeText.Buffer,
|
||||
SafeText.Length);
|
||||
Wnd->WindowName.MaximumLength = SafeText.Length + sizeof(UNICODE_NULL);
|
||||
Wnd->WindowName.Length = SafeText.Length;
|
||||
_SEH2_TRY
|
||||
{
|
||||
Wnd->WindowName.Buffer[SafeText.Length / sizeof(WCHAR)] = L'\0';
|
||||
RtlCopyMemory(Wnd->WindowName.Buffer,
|
||||
SafeText.Buffer,
|
||||
SafeText.Length);
|
||||
Wnd->WindowName.MaximumLength = SafeText.Length + sizeof(UNICODE_NULL);
|
||||
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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue