>From 84fe54a72341f537dea1ad54655e1d4f283084f2 Mon Sep 17 00:00:00 2001 From: Alex Busenius Date: Sun, 21 Oct 2007 13:28:17 +0200 Subject: user32: Fix segfault when combobox contains a longer text than buffer_limit --- dlls/user32/edit.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index 6ea843e..1c23e3a 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -3201,9 +3201,12 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, LPCWSTR lpsz_replac /* Issue the EN_MAXTEXT notification and continue with replacing text * such that buffer limit is honored. */ - if ((honor_limit) && (size > es->buffer_limit)) { + if ((honor_limit) && (es->buffer_limit > 0) && (size > es->buffer_limit)) { EDIT_NOTIFY_PARENT(es, EN_MAXTEXT); strl = es->buffer_limit - (tl - (e-s)); + /* Buffer limit can be smaller than the actual length of text in combobox */ + if (es->buffer_limit < (tl - (e-s))) + strl = 0; } if (!EDIT_MakeFit(es, tl - (e - s) + strl)) -- 1.5.3.4