mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 15:21:47 +00:00
ex_docmd: Fix PVS/V547: due to short-circuiting name_len is never > 4
This commit is contained in:
@@ -5181,11 +5181,13 @@ static void ex_command(exarg_T *eap)
|
|||||||
p = skipwhite(end);
|
p = skipwhite(end);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the name (if any) and skip to the following argument */
|
// Get the name (if any) and skip to the following argument.
|
||||||
name = p;
|
name = p;
|
||||||
if (ASCII_ISALPHA(*p))
|
if (ASCII_ISALPHA(*p)) {
|
||||||
while (ASCII_ISALNUM(*p))
|
while (ASCII_ISALNUM(*p)) {
|
||||||
++p;
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!ends_excmd(*p) && !ascii_iswhite(*p)) {
|
if (!ends_excmd(*p) && !ascii_iswhite(*p)) {
|
||||||
EMSG(_("E182: Invalid command name"));
|
EMSG(_("E182: Invalid command name"));
|
||||||
return;
|
return;
|
||||||
@@ -5203,8 +5205,7 @@ static void ex_command(exarg_T *eap)
|
|||||||
EMSG(_("E183: User defined commands must start with an uppercase letter"));
|
EMSG(_("E183: User defined commands must start with an uppercase letter"));
|
||||||
return;
|
return;
|
||||||
} else if ((name_len == 1 && *name == 'X')
|
} else if ((name_len == 1 && *name == 'X')
|
||||||
|| (name_len <= 4
|
|| (name_len <= 4 && STRNCMP(name, "Next", name_len) == 0)) {
|
||||||
&& STRNCMP(name, "Next", name_len > 4 ? 4 : name_len) == 0)) {
|
|
||||||
EMSG(_("E841: Reserved name, cannot be used for user defined command"));
|
EMSG(_("E841: Reserved name, cannot be used for user defined command"));
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
|
Reference in New Issue
Block a user