diff options
author | ZyX <kp-pav@yandex.ru> | 2017-05-20 04:08:41 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-05-20 04:21:00 +0300 |
commit | 40444e9186a7d3666930de4abfb4662e603d1f06 (patch) | |
tree | 9463ca81e74c32891e9ca7484c03b2071b29f905 | |
parent | 9ec2bf26ce727f7bd114905f106f2d62762e3d93 (diff) | |
download | rneovim-40444e9186a7d3666930de4abfb4662e603d1f06.tar.gz rneovim-40444e9186a7d3666930de4abfb4662e603d1f06.tar.bz2 rneovim-40444e9186a7d3666930de4abfb4662e603d1f06.zip |
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.
-rw-r--r-- | src/nvim/main.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c index a37fefc648..46607da6ea 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -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; |