From 7d8ee43e802c9976d7e1f1c0e7b241bd694acfea Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 28 Sep 2006 13:08:01 +0000 Subject: [PATCH] now checks the real lenght of the passed buffer in BTextView::Insert(). Seems to fix bug 675 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18967 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/TextView.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/kits/interface/TextView.cpp b/src/kits/interface/TextView.cpp index 53f34056a2..b4ba4b35bc 100644 --- a/src/kits/interface/TextView.cpp +++ b/src/kits/interface/TextView.cpp @@ -1105,9 +1105,13 @@ BTextView::Insert(int32 startOffset, const char *inText, int32 inLength, CancelInputMethod(); // do we really need to do anything? - if (inLength < 1) + if (inText == NULL || inLength < 1) return; + int32 realLength = strlen(inText); + if (inLength > realLength) + inLength = realLength; + if (startOffset > TextLength()) startOffset = TextLength(); @@ -3496,9 +3500,8 @@ BTextView::ActualTabWidth(float location) const void -BTextView::DoInsertText(const char *inText, int32 inLength, int32 inOffset, - const text_run_array *inRuns, - _BTextChangeResult_ *outResult) +BTextView::DoInsertText(const char *inText, int32 inLength, int32 inOffset, + const text_run_array *inRuns, _BTextChangeResult_ *outResult) { CALLED(); }