Commit 32393796 authored by Dan Kegel's avatar Dan Kegel Committed by Alexandre Julliard

gdi32: GdiConvertToDevmodeW should not refer to unintialized name bytes.

parent 97f4fbca
......@@ -431,15 +431,19 @@ DEVMODEW * WINAPI GdiConvertToDevmodeW(const DEVMODEA *dmA)
dmW = HeapAlloc(GetProcessHeap(), 0, dmW_size + dmA->dmDriverExtra);
if (!dmW) return NULL;
MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmDeviceName, CCHDEVICENAME,
MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmDeviceName, -1,
dmW->dmDeviceName, CCHDEVICENAME);
/* copy slightly more, to avoid long computations */
memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion, dmA_size - CCHDEVICENAME);
if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
{
MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmFormName, CCHFORMNAME,
if (dmA->dmFields & DM_FORMNAME)
MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmFormName, -1,
dmW->dmFormName, CCHFORMNAME);
else
dmW->dmFormName[0] = 0;
if (dmA_size > FIELD_OFFSET(DEVMODEA, dmLogPixels))
memcpy(&dmW->dmLogPixels, &dmA->dmLogPixels, dmA_size - FIELD_OFFSET(DEVMODEA, dmLogPixels));
}
......
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