aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-30 21:40:30 +0800
committerGitHub <noreply@github.com>2022-07-30 21:40:30 +0800
commitd36d9be8ff0e03a7cbba087abb9167056f9c56c7 (patch)
treeb78cbdab274822e3236e40119a61b548a7cab561 /src
parentc34d72bf7cc149db7b17ef57f2c961b54cd46ff7 (diff)
downloadrneovim-d36d9be8ff0e03a7cbba087abb9167056f9c56c7.tar.gz
rneovim-d36d9be8ff0e03a7cbba087abb9167056f9c56c7.tar.bz2
rneovim-d36d9be8ff0e03a7cbba087abb9167056f9c56c7.zip
fix(terminal): avoid reading over the end of cell.chars (#19580)
Diffstat (limited to 'src')
-rw-r--r--src/nvim/terminal.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 73af00b5d1..fc02d9d53a 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -1384,7 +1384,7 @@ static void fetch_row(Terminal *term, int row, int end_col)
fetch_cell(term, row, col, &cell);
if (cell.chars[0]) {
int cell_len = 0;
- for (int i = 0; cell.chars[i]; i++) {
+ for (int i = 0; i < VTERM_MAX_CHARS_PER_CELL && cell.chars[i]; i++) {
cell_len += utf_char2bytes((int)cell.chars[i], ptr + cell_len);
}
ptr += cell_len;