aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/history.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/history.c b/src/history.c
index 6da3d9a0..83577cd7 100644
--- a/src/history.c
+++ b/src/history.c
@@ -482,7 +482,7 @@ static size_t bc_history_colPos(const char *buf, size_t buf_len, size_t pos) {
size_t ret = 0, off = 0;
// While we haven't reached the offset, get the length of the next grapheme.
- while (off < pos) {
+ while (off < pos && pos < buf_len) {
size_t col_len, len;