aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorZufu Liu <unknown>2019-05-04 07:33:36 +1000
committerZufu Liu <unknown>2019-05-04 07:33:36 +1000
commited4e980d89d366e967b754212fd226e8352e0f68 (patch)
tree08b319fdc4de179ec46ac7b977a2c7ec788d9a67 /src
parentfd00af6bd9cb38ab9719bce0c1360c395c026a8d (diff)
downloadscintilla-mirror-ed4e980d89d366e967b754212fd226e8352e0f68.tar.gz
Bug [#2102]. Allow length argument to be past end of document for SCI_GETTEXT.
More compatible with state before change set 7489.
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 42b71e3c8..cb6a8a183 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -5796,7 +5796,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
if (wParam == 0)
return 0;
char *ptr = CharPtrFromSPtr(lParam);
- const Sci_Position len = wParam - 1;
+ const Sci_Position len = std::min<Sci_Position>(wParam - 1, pdoc->Length());
pdoc->GetCharRange(ptr, 0, len);
ptr[len] = '\0';
return len;