Commit c362081a authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Moved the class extra bytes check to catch uninitialised data sooner.

parent bd5c02e2
...@@ -338,11 +338,6 @@ static CLASS *CLASS_RegisterClass( LPCWSTR name, HINSTANCE hInstance, BOOL local ...@@ -338,11 +338,6 @@ static CLASS *CLASS_RegisterClass( LPCWSTR name, HINSTANCE hInstance, BOOL local
/* Fix the extra bytes value */ /* Fix the extra bytes value */
if (classExtra < 0 || winExtra < 0)
{
SetLastError( ERROR_INVALID_PARAMETER );
return NULL;
}
if (classExtra > 40) /* Extra bytes are limited to 40 in Win32 */ if (classExtra > 40) /* Extra bytes are limited to 40 in Win32 */
WARN("Class extra bytes %d is > 40\n", classExtra); WARN("Class extra bytes %d is > 40\n", classExtra);
if (winExtra > 40) /* Extra bytes are limited to 40 in Win32 */ if (winExtra > 40) /* Extra bytes are limited to 40 in Win32 */
...@@ -526,9 +521,9 @@ ATOM WINAPI RegisterClassExA( const WNDCLASSEXA* wc ) ...@@ -526,9 +521,9 @@ ATOM WINAPI RegisterClassExA( const WNDCLASSEXA* wc )
CLASS *classPtr; CLASS *classPtr;
HINSTANCE instance; HINSTANCE instance;
if (wc->hInstance == user32_module) if (wc->cbClsExtra < 0 || wc->cbWndExtra < 0 ||
wc->hInstance == user32_module) /* we can't register a class for user32 */
{ {
/* we can't register a class for user32 */
SetLastError( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return 0; return 0;
} }
...@@ -575,9 +570,9 @@ ATOM WINAPI RegisterClassExW( const WNDCLASSEXW* wc ) ...@@ -575,9 +570,9 @@ ATOM WINAPI RegisterClassExW( const WNDCLASSEXW* wc )
CLASS *classPtr; CLASS *classPtr;
HINSTANCE instance; HINSTANCE instance;
if (wc->hInstance == user32_module) if (wc->cbClsExtra < 0 || wc->cbWndExtra < 0 ||
wc->hInstance == user32_module) /* we can't register a class for user32 */
{ {
/* we can't register a class for user32 */
SetLastError( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment