riched20: Fix the struct size check in the para fmt retrieval function.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2020-10-27 08:23:30 +00:00 committed by Alexandre Julliard
parent 1abbb78a09
commit 9908c5d3c4
1 changed files with 5 additions and 3 deletions

View File

@ -928,7 +928,8 @@ void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt)
ME_DisplayItem *para, *para_end;
PARAFORMAT2 *curFmt;
if (pFmt->cbSize < sizeof(PARAFORMAT)) {
if (pFmt->cbSize < sizeof(PARAFORMAT))
{
pFmt->dwMask = 0;
return;
}
@ -951,13 +952,14 @@ void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt)
CHECK_FIELD(PFM_RIGHTINDENT, dxRightIndent);
CHECK_FIELD(PFM_OFFSET, dxOffset);
CHECK_FIELD(PFM_ALIGNMENT, wAlignment);
if (pFmt->dwMask & PFM_TABSTOPS) {
if (pFmt->dwMask & PFM_TABSTOPS)
{
if (pFmt->cTabCount != para->member.para.fmt.cTabCount ||
memcmp(pFmt->rgxTabs, curFmt->rgxTabs, curFmt->cTabCount*sizeof(int)))
pFmt->dwMask &= ~PFM_TABSTOPS;
}
if (pFmt->dwMask >= sizeof(PARAFORMAT2))
if (pFmt->cbSize >= sizeof(PARAFORMAT2))
{
pFmt->dwMask &= ~((pFmt->wEffects ^ curFmt->wEffects) << 16);
CHECK_FIELD(PFM_SPACEBEFORE, dySpaceBefore);