# HG changeset patch # User Bram Moolenaar # Date 1675701905 -3600 # Node ID 1ae3ad2e3d03754ca6b96dbdcaf39de2e8d3e517 # Parent c3525d8cfea3db081cc9e7ed2230d58fc53648b3 patch 9.0.1286: Coverity warns for using a NULL pointer Commit: https://github.com/vim/vim/commit/546933f4974d0e0966a4d4e78a6a46b7532d71c6 Author: Bram Moolenaar Date: Mon Feb 6 16:40:49 2023 +0000 patch 9.0.1286: Coverity warns for using a NULL pointer Problem: Coverity warns for using a NULL pointer. Solution: Bail out whan "varp" is NULL. diff --git a/src/option.c b/src/option.c --- a/src/option.c +++ b/src/option.c @@ -1815,7 +1815,8 @@ do_set_string( } /* - * Set a boolean option + * Set a boolean option. + * Returns an untranslated error message or NULL. */ static char * do_set_option_bool( @@ -1833,6 +1834,8 @@ do_set_option_bool( if (nextchar == '=' || nextchar == ':') return e_invalid_argument; + if (opt_idx < 0 || varp == NULL) + return NULL; // "cannot happen" /* * ":set opt!": invert @@ -1870,7 +1873,8 @@ do_set_option_bool( } /* - * Set a numeric option + * Set a numeric option. + * Returns an untranslated error message or NULL. */ static char * do_set_option_numeric( @@ -1890,6 +1894,9 @@ do_set_option_numeric( 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,8 +2216,8 @@ do_set_option( } /* - * allow '=' and ':' for historical reasons (MSDOS command.com - * allows only one '=' character per "set" command line. grrr. (jw) + * Allow '=' and ':' for historical reasons (MSDOS command.com). + * Allows only one '=' character per "set" command line. grrr. (jw) */ if (nextchar == '?' || (prefix == PREFIX_NONE diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1286, +/**/ 1285, /**/ 1284,