summaryrefslogtreecommitdiff
path: root/src/selection.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-07-02 21:14:01 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-07-05 12:10:06 +0100
commited68d1ff287d43c5293abb4d41e908aa8e50afec (patch)
treeb5ab042ba67259a63b2aa0ae99ad74a5bc646a7f /src/selection.cc
parent3f70d91f8c716ef2dbc76abb9c878f86ecb946f7 (diff)
utf8: use end of sequence iterators for more security
Diffstat (limited to 'src/selection.cc')
-rw-r--r--src/selection.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/selection.cc b/src/selection.cc
index d8808054..bd18bf85 100644
--- a/src/selection.cc
+++ b/src/selection.cc
@@ -446,7 +446,7 @@ BufferIterator prepare_insert(Buffer& buffer, const Selection& sel, InsertMode m
{
// special case for end of lines, append to current line instead
auto pos = buffer.iterator_at(sel.max());
- return *pos == '\n' ? pos : utf8::next(pos);
+ return *pos == '\n' ? pos : utf8::next(pos, buffer.end());
}
case InsertMode::InsertAtLineBegin:
return buffer.iterator_at(sel.min().line);