mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
coverity/166184: Check length of str, not term
32396b5879
add length checks to
TERMINAL_FAMILY/STARTS_WITH to ensure memcmp() wouldn't read past the
end of the string. However, "term" was copy/pasted from TERMINAL_FAMILY
so STARTS_WITH() was unnecessarily reading the, potentially NULL, term
variable.
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
#define OUTBUF_SIZE 0xffff
|
||||
|
||||
#define TOO_MANY_EVENTS 1000000
|
||||
#define STARTS_WITH(str, prefix) (strlen(term) >= (sizeof(prefix) - 1) \
|
||||
#define STARTS_WITH(str, prefix) (strlen(str) >= (sizeof(prefix) - 1) \
|
||||
&& 0 == memcmp((str), (prefix), sizeof(prefix) - 1))
|
||||
#define TMUX_WRAP(is_tmux, seq) ((is_tmux) \
|
||||
? "\x1bPtmux;\x1b" seq "\x1b\\" : seq)
|
||||
|
Reference in New Issue
Block a user