Skip to content

Commit 4e5e90c

Browse files
committed
[WIN32K] Add some missing parameter checks. Fixes all but 4 tests in win32knt:NtUserEnumDisplaySettings. By Peter Hater. CORE-11524
svn path=/trunk/; revision=72624
1 parent d4b414c commit 4e5e90c

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

reactos/win32ss/user/ntuser/display.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,8 +572,28 @@ NtUserEnumDisplaySettings(
572572
TRACE("Enter NtUserEnumDisplaySettings(%wZ, %lu, %p, 0x%lx)\n",
573573
pustrDevice, iModeNum, lpDevMode, dwFlags);
574574

575+
_SEH2_TRY
576+
{
577+
ProbeForWrite(lpDevMode, sizeof(DEVMODEW), 1);
578+
}
579+
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
580+
{
581+
_SEH2_YIELD(return _SEH2_GetExceptionCode());
582+
}
583+
_SEH2_END
584+
585+
if (lpDevMode->dmSize != sizeof(DEVMODEW))
586+
{
587+
return STATUS_BUFFER_TOO_SMALL;
588+
}
589+
575590
if (pustrDevice)
576591
{
592+
if (pustrDevice->Buffer == NULL || pustrDevice->Length == 0)
593+
{
594+
Status = STATUS_INVALID_PARAMETER_1;
595+
}
596+
577597
/* Initialize destination string */
578598
RtlInitEmptyUnicodeString(&ustrDevice, awcDevice, sizeof(awcDevice));
579599

@@ -647,10 +667,16 @@ NtUserEnumDisplaySettings(
647667
}
648668
_SEH2_END;
649669
}
670+
else
671+
{
672+
if (Status == STATUS_UNSUCCESSFUL)
673+
{
674+
Status = STATUS_INVALID_PARAMETER_1;
675+
}
676+
}
650677

651678
return Status;
652679
}
653-
654680
VOID
655681
UserUpdateFullscreen(
656682
DWORD flags)

0 commit comments

Comments
 (0)