diff options
author | Paul Burlumi <paul@burlumi.com> | 2014-08-19 22:06:31 +0100 |
---|---|---|
committer | Paul Burlumi <paul@burlumi.com> | 2014-08-19 22:06:55 +0100 |
commit | aca6dc50016bb6ebfe53b72dafca369ebcc99d29 (patch) | |
tree | 42f5b38e7fe4261bddaaafe1791995016f15e089 /src | |
parent | a40a7cf24f5a57963388cef5c5472ab4047d568f (diff) | |
download | rneovim-aca6dc50016bb6ebfe53b72dafca369ebcc99d29.tar.gz rneovim-aca6dc50016bb6ebfe53b72dafca369ebcc99d29.tar.bz2 rneovim-aca6dc50016bb6ebfe53b72dafca369ebcc99d29.zip |
coverity/13749: fix negative array index read in unset_global_local_option
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/option.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 6428ef1eb3..943bda88dc 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -6516,10 +6516,13 @@ void comp_col(void) void unset_global_local_option(char *name, void *from) { struct vimoption *p; - int opt_idx; buf_T *buf = (buf_T *)from; - opt_idx = findoption((uint8_t *)name); + int opt_idx = findoption((uint8_t *)name); + if (opt_idx < 0) { + EMSG2(_("E355: Unknown option: %s"), name); + return; + } p = &(options[opt_idx]); switch ((int)p->indir) |