user32: Fix buffer overflow in EDIT_EM_ReplaceSel().
After EN_MAXTEXT notification, available space may be larger than length of the string. This must be checked and strl must not be set to a value larger than the actual length of the string. Signed-off-by: Roman Pišl <rpisl@seznam.cz> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
71bd13391b
commit
9de8ea7564
|
@ -2598,7 +2598,7 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, LPCWSTR lpsz_replac
|
|||
if (es->buffer_limit < (tl - (e-s)))
|
||||
strl = 0;
|
||||
else
|
||||
strl = es->buffer_limit - (tl - (e-s));
|
||||
strl = min(strl, es->buffer_limit - (tl - (e-s)));
|
||||
}
|
||||
|
||||
if (!EDIT_MakeFit(es, tl - (e - s) + strl))
|
||||
|
|
Loading…
Reference in New Issue