To: vim_dev@googlegroups.com Subject: Patch 9.0.1286 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1286 Problem: Coverity warns for using a NULL pointer. Solution: Bail out whan "varp" is NULL. Files: src/option.c *** ../vim-9.0.1285/src/option.c 2023-02-05 17:04:47.322125895 +0000 --- src/option.c 2023-02-06 16:38:17.503099736 +0000 *************** *** 1815,1821 **** } /* ! * Set a boolean option */ static char * do_set_option_bool( --- 1815,1822 ---- } /* ! * Set a boolean option. ! * Returns an untranslated error message or NULL. */ static char * do_set_option_bool( *************** *** 1833,1838 **** --- 1834,1841 ---- if (nextchar == '=' || nextchar == ':') return e_invalid_argument; + if (opt_idx < 0 || varp == NULL) + return NULL; // "cannot happen" /* * ":set opt!": invert *************** *** 1870,1876 **** } /* ! * Set a numeric option */ static char * do_set_option_numeric( --- 1873,1880 ---- } /* ! * Set a numeric option. ! * Returns an untranslated error message or NULL. */ static char * do_set_option_numeric( *************** *** 1890,1895 **** --- 1894,1902 ---- int i; char *errmsg = NULL; + if (opt_idx < 0 || varp == NULL) + return NULL; // "cannot happen" + // /* * Different ways to set a number option: * & set to default value *************** *** 2209,2216 **** } /* ! * allow '=' and ':' for historical reasons (MSDOS command.com ! * allows only one '=' character per "set" command line. grrr. (jw) */ if (nextchar == '?' || (prefix == PREFIX_NONE --- 2216,2223 ---- } /* ! * Allow '=' and ':' for historical reasons (MSDOS command.com). ! * Allows only one '=' character per "set" command line. grrr. (jw) */ if (nextchar == '?' || (prefix == PREFIX_NONE *** ../vim-9.0.1285/src/version.c 2023-02-05 18:00:38.353400148 +0000 --- src/version.c 2023-02-06 16:36:41.115084630 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1286, /**/ -- I AM THANKFUL... ...for the clothes that fit a little too snug because it means I have more than enough to eat. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///