mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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>
This commit is contained in:
parent
5a6c7c805b
commit
7a3fef9e34
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user