Andrey Melnikov : gdi32: Handle NULL filename in GetICMProfileA().
Alexandre Julliard
julliard at winehq.org
Fri Oct 7 15:09:15 CDT 2016
Module: wine
Branch: stable
Commit: 0ad53eeecea1a1c5306d1ff38154b46a51f0e59b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0ad53eeecea1a1c5306d1ff38154b46a51f0e59b
Author: Andrey Melnikov <temnota.am at gmail.com>
Date: Mon Dec 21 12:22:41 2015 +0300
gdi32: Handle NULL filename in GetICMProfileA().
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Andrey Melnikov <temnota.am at gmail.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit d4d304f4365134a6aec0fad18989e3c5f1950fe1)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/gdi32/icm.c | 9 ++++++++-
dlls/gdi32/tests/icm.c | 1 -
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/gdi32/icm.c b/dlls/gdi32/icm.c
index d3a345d..9d0e2f6 100644
--- a/dlls/gdi32/icm.c
+++ b/dlls/gdi32/icm.c
@@ -116,11 +116,18 @@ BOOL WINAPI GetICMProfileA(HDC hdc, LPDWORD size, LPSTR filename)
TRACE("%p, %p, %p\n", hdc, size, filename);
- if (!hdc || !size || !filename) return FALSE;
+ if (!hdc || !size) return FALSE;
if (GetICMProfileW(hdc, &buflen, filenameW))
{
int len = WideCharToMultiByte(CP_ACP, 0, filenameW, -1, NULL, 0, NULL, NULL);
+
+ if (!filename)
+ {
+ *size = len;
+ return FALSE;
+ }
+
if (*size >= len)
{
WideCharToMultiByte(CP_ACP, 0, filenameW, -1, filename, *size, NULL, NULL);
diff --git a/dlls/gdi32/tests/icm.c b/dlls/gdi32/tests/icm.c
index 764d0d2..6208090 100644
--- a/dlls/gdi32/tests/icm.c
+++ b/dlls/gdi32/tests/icm.c
@@ -55,7 +55,6 @@ static void test_GetICMProfileA( HDC dc )
size = 0;
ret = GetICMProfileA( dc, &size, NULL );
ok( !ret, "GetICMProfileA succeeded\n" );
-todo_wine
ok( size > 0, "got %u\n", size );
size = MAX_PATH;
More information about the wine-cvs
mailing list