Check structure size and fix return values in EM_GETCHARFORMAT.

oldstable
Felix Nawothnig 2005-07-11 10:22:33 +00:00 committed by Alexandre Julliard
parent 521d067ba9
commit af4009d2fd
1 changed files with 8 additions and 3 deletions

View File

@ -1076,14 +1076,19 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
}
case EM_GETCHARFORMAT:
{
CHARFORMAT2W tmp;
CHARFORMAT2W tmp, *dst = (CHARFORMAT2W *)lParam;
if (dst->cbSize != sizeof(CHARFORMATA) &&
dst->cbSize != sizeof(CHARFORMATW) &&
dst->cbSize != sizeof(CHARFORMAT2A) &&
dst->cbSize != sizeof(CHARFORMAT2W))
return 0;
tmp.cbSize = sizeof(tmp);
if (!wParam)
ME_GetDefaultCharFormat(editor, &tmp);
else
ME_GetSelectionCharFormat(editor, &tmp);
ME_CopyToCFAny((CHARFORMAT2W *)lParam, &tmp);
return 0;
ME_CopyToCFAny(dst, &tmp);
return tmp.dwMask;
}
case EM_SETPARAFORMAT:
ME_SetSelectionParaFormat(editor, (PARAFORMAT2 *)lParam);