Author: gschneider
Date: Sun Apr 12 22:44:00 2009
New Revision: 40473
URL:
http://svn.reactos.org/svn/reactos?rev=40473&view=rev
Log:
- Add parameter validity check to GetTextFaceA (same as in GetTextFaceW)
Modified:
trunk/reactos/dll/win32/gdi32/objects/text.c
Modified: trunk/reactos/dll/win32/gdi32/objects/text.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/te…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/text.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/objects/text.c [iso-8859-1] Sun Apr 12 22:44:00 2009
@@ -383,8 +383,19 @@
WINAPI
GetTextFaceA( HDC hdc, INT count, LPSTR name )
{
- INT res = GetTextFaceW(hdc, 0, NULL);
- LPWSTR nameW = HeapAlloc( GetProcessHeap(), 0, res * 2 );
+ INT res;
+ LPWSTR nameW;
+
+ /* Validate parameters */
+ if (name && count <= 0)
+ {
+ /* Set last error and return failure */
+ GdiSetLastError(ERROR_INVALID_PARAMETER);
+ return 0;
+ }
+
+ res = GetTextFaceW(hdc, 0, NULL);
+ nameW = HeapAlloc( GetProcessHeap(), 0, res * 2 );
GetTextFaceW( hdc, res, nameW );
if (name)