Commit 9de8ea75 authored by Roman Pišl's avatar Roman Pišl Committed by Alexandre Julliard

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: 's avatarRoman Pišl <rpisl@seznam.cz> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 71bd1339
......@@ -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))
......
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