Author: akhaldi
Date: Thu Sep 8 20:25:30 2016
New Revision: 72624
URL:
http://svn.reactos.org/svn/reactos?rev=72624&view=rev
Log:
[WIN32K] Add some missing parameter checks. Fixes all but 4 tests in
win32knt:NtUserEnumDisplaySettings. By Peter Hater. CORE-11524
Modified:
trunk/reactos/win32ss/user/ntuser/display.c
Modified: trunk/reactos/win32ss/user/ntuser/display.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/displa…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/display.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/display.c [iso-8859-1] Thu Sep 8 20:25:30 2016
@@ -572,8 +572,28 @@
TRACE("Enter NtUserEnumDisplaySettings(%wZ, %lu, %p, 0x%lx)\n",
pustrDevice, iModeNum, lpDevMode, dwFlags);
+ _SEH2_TRY
+ {
+ ProbeForWrite(lpDevMode, sizeof(DEVMODEW), 1);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
+ }
+ _SEH2_END
+
+ if (lpDevMode->dmSize != sizeof(DEVMODEW))
+ {
+ return STATUS_BUFFER_TOO_SMALL;
+ }
+
if (pustrDevice)
{
+ if (pustrDevice->Buffer == NULL || pustrDevice->Length == 0)
+ {
+ Status = STATUS_INVALID_PARAMETER_1;
+ }
+
/* Initialize destination string */
RtlInitEmptyUnicodeString(&ustrDevice, awcDevice, sizeof(awcDevice));
@@ -647,10 +667,16 @@
}
_SEH2_END;
}
+ else
+ {
+ if (Status == STATUS_UNSUCCESSFUL)
+ {
+ Status = STATUS_INVALID_PARAMETER_1;
+ }
+ }
return Status;
}
-
VOID
UserUpdateFullscreen(
DWORD flags)