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
commit19119c5118b845f3bfd0b0c63441336019ecc351 (patch)
tree117050651ad9bb6b9427ea79236f9cb9098abee2 /src
parent9e002fa3716e99b6170a9c6339194c7a6dcb4f87 (diff)
downloadscintilla-mirror-19119c5118b845f3bfd0b0c63441336019ecc351.tar.gz
Backport: Bug [#2102]. Allow length argument to be past end of document for SCI_GETTEXT.
More compatible with state before change set 7489. Backport of changeset 7490:2550e2a306c0.
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 cd214de56..3d76952c1 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -5792,7 +5792,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;