Commit 331bf3d7 authored by Alexandre Julliard's avatar Alexandre Julliard

Avoid trouble in WM_GETTEXT if specified length is larger than the

buffer (found by Carl Sopchak).
parent ebd110bc
......@@ -3962,15 +3962,14 @@ static INT EDIT_WM_GetText(EDITSTATE *es, INT count, LPARAM lParam, BOOL unicode
if(unicode)
{
LPWSTR textW = (LPWSTR)lParam;
strncpyW(textW, es->text, count);
textW[count - 1] = 0; /* ensure 0 termination */
lstrcpynW(textW, es->text, count);
return strlenW(textW);
}
else
{
LPSTR textA = (LPSTR)lParam;
WideCharToMultiByte(CP_ACP, 0, es->text, -1, textA, count, NULL, NULL);
textA[count - 1] = 0; /* ensure 0 termination */
if (!WideCharToMultiByte(CP_ACP, 0, es->text, -1, textA, count, NULL, NULL))
textA[count - 1] = 0; /* ensure 0 termination */
return strlen(textA);
}
}
......
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