Author: hbelusca
Date: Tue Jun 18 22:14:50 2013
New Revision: 59257

URL: http://svn.reactos.org/svn/reactos?rev=59257&view=rev
Log:
[WIN32K]
Check for NULL pointer returned by PEN_AllocPenWithHandle before dereferencing 
the returned pointer (the allocation function can return NULL in low memory 
conditions, leading to kernel crashes).

Modified:
    trunk/reactos/win32ss/gdi/ntgdi/stockobj.c

Modified: trunk/reactos/win32ss/gdi/ntgdi/stockobj.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/stockobj.c?rev=59257&r1=59256&r2=59257&view=diff
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/stockobj.c  [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/stockobj.c  [iso-8859-1] Tue Jun 18 
22:14:50 2013
@@ -107,7 +107,10 @@
                   ULONG ulColor)
 {
     HPEN hPen;
-    PBRUSH pbrushPen = PEN_AllocPenWithHandle();
+    PBRUSH pbrushPen;
+
+    pbrushPen = PEN_AllocPenWithHandle();
+    if (pbrushPen == NULL) return NULL;
 
     if ((dwPenStyle & PS_STYLE_MASK) == PS_NULL) dwWidth = 1;
 


Reply via email to