Module: wine Branch: master Commit: eaf7becabd8457c849135e18c269e634202a52d4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=eaf7becabd8457c849135e18c2...
Author: Dylan Smith dylan.ah.smith@gmail.com Date: Wed Jun 25 11:32:52 2008 -0400
richedit: Null pointer check missing on optional parameter.
The function ME_FindRunInRow uses two parameters to return values by reference, and treated these parameters as if they were optional except for the start of the function which set *pbCaretAtEnd without checking to see if was a NULL pointer.
---
dlls/riched20/caret.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index 02c375c..5ed2329 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -975,13 +975,13 @@ static ME_DisplayItem *ME_FindRunInRow(ME_TextEditor *editor, ME_DisplayItem *pR pNext = ME_FindItemFwd(pRow, diRunOrStartRow); assert(pNext->type == diRun); pLastRun = pNext; - *pbCaretAtEnd = FALSE; + if (pbCaretAtEnd) *pbCaretAtEnd = FALSE; + if (pOffset) *pOffset = 0; do { int run_x = pNext->member.run.pt.x; int width = pNext->member.run.nWidth; if (x < run_x) { - if (pOffset) *pOffset = 0; return pNext; } if (x >= run_x && x < run_x+width) @@ -1001,12 +1001,9 @@ static ME_DisplayItem *ME_FindRunInRow(ME_TextEditor *editor, ME_DisplayItem *pR if ((pLastRun->member.run.nFlags & MERF_ENDPARA) == 0) { pNext = ME_FindItemFwd(pNext, diRun); - if (pbCaretAtEnd) *pbCaretAtEnd = 1; - if (pOffset) *pOffset = 0; + if (pbCaretAtEnd) *pbCaretAtEnd = TRUE; return pNext; } else { - if (pbCaretAtEnd) *pbCaretAtEnd = 0; - if (pOffset) *pOffset = 0; return pLastRun; } }