- null terminate DesktopObject->pDeskInfo->szDesktopName and WindowStationObject->Name
- null terminate the buffer when NtUserGetObjectInformation is called with UOI_NAME parameter
- should fix a random failure in user32:desktop tests

svn path=/trunk/; revision=55857
This commit is contained in:
Giannis Adamopoulos 2012-02-25 18:26:05 +00:00
parent 7d3f5052d0
commit bde6f12e52
2 changed files with 10 additions and 10 deletions

View file

@ -845,7 +845,7 @@ NtUserCreateDesktop(
{
ProbeForRead( ObjectAttributes, sizeof(OBJECT_ATTRIBUTES), 1);
Status = IntSafeCopyUnicodeString(&DesktopName, ObjectAttributes->ObjectName);
Status = IntSafeCopyUnicodeStringTerminateNULL(&DesktopName, ObjectAttributes->ObjectName);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
@ -886,7 +886,7 @@ NtUserCreateDesktop(
RETURN(NULL);
}
DesktopInfoSize = sizeof(DESKTOPINFO) + DesktopName.Length;
DesktopInfoSize = sizeof(DESKTOPINFO) + DesktopName.Length + sizeof(WCHAR);
DesktopObject->pDeskInfo = RtlAllocateHeap(DesktopObject->pheapDesktop,
HEAP_NO_SERIALIZE,
@ -906,7 +906,7 @@ NtUserCreateDesktop(
DesktopObject->pDeskInfo->pvDesktopLimit = (PVOID)((ULONG_PTR)DesktopHeapSystemBase + HeapSize);
RtlCopyMemory(DesktopObject->pDeskInfo->szDesktopName,
DesktopName.Buffer,
DesktopName.Length);
DesktopName.Length + sizeof(WCHAR));
/* Initialize some local (to win32k) desktop state. */
InitializeListHead(&DesktopObject->PtiList);

View file

@ -364,7 +364,7 @@ NtUserCreateWindowStation(
_SEH2_TRY
{
ProbeForRead( ObjectAttributes, sizeof(OBJECT_ATTRIBUTES), 1);
Status = IntSafeCopyUnicodeString(&WindowStationName, ObjectAttributes->ObjectName);
Status = IntSafeCopyUnicodeStringTerminateNULL(&WindowStationName, ObjectAttributes->ObjectName);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
@ -653,14 +653,14 @@ NtUserGetObjectInformation(
case UOI_NAME:
if (WinStaObject != NULL)
{
pvData = ((PUNICODE_STRING)GET_DESKTOP_NAME(WinStaObject))->Buffer;
nDataSize = ((PUNICODE_STRING)GET_DESKTOP_NAME(WinStaObject))->Length + 2;
pvData = WinStaObject->Name.Buffer;
nDataSize = WinStaObject->Name.Length + sizeof(WCHAR);
Status = STATUS_SUCCESS;
}
else if (DesktopObject != NULL)
{
pvData = ((PUNICODE_STRING)GET_DESKTOP_NAME(DesktopObject))->Buffer;
nDataSize = ((PUNICODE_STRING)GET_DESKTOP_NAME(DesktopObject))->Length + 2;
pvData = DesktopObject->pDeskInfo->szDesktopName;
nDataSize = (wcslen(DesktopObject->pDeskInfo->szDesktopName) + 1) * sizeof(WCHAR);
Status = STATUS_SUCCESS;
}
else
@ -671,13 +671,13 @@ NtUserGetObjectInformation(
if (WinStaObject != NULL)
{
pvData = L"WindowStation";
nDataSize = (wcslen(pvData) + 1) * sizeof(WCHAR);
nDataSize = sizeof(L"WindowStation");
Status = STATUS_SUCCESS;
}
else if (DesktopObject != NULL)
{
pvData = L"Desktop";
nDataSize = (wcslen(pvData) + 1) * sizeof(WCHAR);
nDataSize = sizeof(L"Desktop");
Status = STATUS_SUCCESS;
}
else