mirror of
https://github.com/neovim/neovim.git
synced 2024-12-25 05:35:10 -07:00
main: Silence V522: potential NULL pointer dereference
AFAIK there is no way NULL can be there, including from the line it points to. Dunno what analyser was thinking, but dereferencing of `argv[0]` happened just before `get_number_arg()` call: in `ascii_isdigit()` two lines above. And `idx` cannot possibly be NULL ever, it comes from `&varname`, this could not ever give anything, but a valid pointer.
This commit is contained in:
parent
9ec2bf26ce
commit
40444e9186
@ -656,8 +656,9 @@ void getout(int exitval)
|
||||
///
|
||||
/// @return argument's numeric value otherwise
|
||||
static int get_number_arg(const char *p, int *idx, int def)
|
||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
if (ascii_isdigit(p[*idx])) {
|
||||
if (ascii_isdigit(p[*idx])) { // -V522
|
||||
def = atoi(&(p[*idx]));
|
||||
while (ascii_isdigit(p[*idx])) {
|
||||
*idx = *idx + 1;
|
||||
|
Loading…
Reference in New Issue
Block a user