mirror of
https://github.com/neovim/neovim.git
synced 2025-11-26 12:10:40 +00:00
Use vim_strchr(s, c) when c may be NUL (#6656)
As part of the refactoring in #5119, some vim_strchr() were changed to strchr(). However, vim_strchr() behaves differently than strchr() when c is NUL, returning NULL instead of a pointer to the NUL. Revert the strchr() calls where it isn't known whether c is NUL, since this causes a semantic change the surrounding code doesn't expect. In the case of #6650, this led to a heap overrun. Closes #6650
This commit is contained in:
committed by
Justin M. Keyes
parent
08b23d0806
commit
de50c003d5
@@ -1411,7 +1411,8 @@ do_set (
|
||||
errmsg = (char_u *)set_bool_option(opt_idx, varp, (int)value,
|
||||
opt_flags);
|
||||
} else { // Numeric or string.
|
||||
if (strchr("=:&<", nextchar) == NULL || prefix != 1) {
|
||||
if (vim_strchr((const char_u *)"=:&<", nextchar) == NULL
|
||||
|| prefix != 1) {
|
||||
errmsg = e_invarg;
|
||||
goto skip;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user