neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 7a3fef9e348be541c585fd3544c912950387641f
parent 5a6c7c805b8bb1d1ed9fe829ed33f18ffa6f4f47
Author: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
Date:   Sat, 19 Aug 2023 02:19:36 +0200

refactor(tui): check for out of bound access after snprintf (#24751)

Counterintuitively, snprintf returns the number of characters it _should
have written_ if it had not encoutered the length bound, thus leading to
a potential buffer overflow.

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Diffstat:
Msrc/nvim/tui/input.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c @@ -297,10 +297,10 @@ static void forward_simple_utf8(TermInput *input, TermKeyKey *key) } else { buf[len++] = *ptr; } + assert(len < sizeof(buf)); ptr++; } - assert(len < sizeof(buf)); tinput_enqueue(input, buf, len); }