aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorVanaIgr <vanaigranov@gmail.com>2024-02-26 04:12:55 -0600
committerGitHub <noreply@github.com>2024-02-26 18:12:55 +0800
commitad5a155b1f4b387d3aaa54c91d0146cb0287bb9f (patch)
treeae35dff22d4f418f040d39acc88206e64ffb1984 /src/nvim/buffer.c
parent8b4e26915612caf2d143edca31919cae18a848a1 (diff)
downloadrneovim-ad5a155b1f4b387d3aaa54c91d0146cb0287bb9f.tar.gz
rneovim-ad5a155b1f4b387d3aaa54c91d0146cb0287bb9f.tar.bz2
rneovim-ad5a155b1f4b387d3aaa54c91d0146cb0287bb9f.zip
fix(mbyte): fix bugs in utf_cp_*_off() functions
Problems: - Illegal bytes after valid UTF-8 char cause utf_cp_*_off() to fail. - When stream isn't NUL-terminated, utf_cp_*_off() may go over the end. Solution: Don't go over end of the char of end of the string.
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r--src/nvim/buffer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index ac6ccf223c..2ceed20768 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -3436,7 +3436,7 @@ void maketitle(void)
int len = (int)strlen(buf_p);
if (len > 100) {
len -= 100;
- len += utf_cp_tail_off(buf_p, buf_p + len) + 1;
+ len += utf_cp_bounds(buf_p, buf_p + len).end_off;
buf_p += len;
}
STRCPY(icon_str, buf_p);