forked from aniani/vim
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.
This commit is contained in:
15
src/option.c
15
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 *
|
static char *
|
||||||
do_set_option_bool(
|
do_set_option_bool(
|
||||||
@@ -1833,6 +1834,8 @@ do_set_option_bool(
|
|||||||
|
|
||||||
if (nextchar == '=' || nextchar == ':')
|
if (nextchar == '=' || nextchar == ':')
|
||||||
return e_invalid_argument;
|
return e_invalid_argument;
|
||||||
|
if (opt_idx < 0 || varp == NULL)
|
||||||
|
return NULL; // "cannot happen"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ":set opt!": invert
|
* ":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 *
|
static char *
|
||||||
do_set_option_numeric(
|
do_set_option_numeric(
|
||||||
@@ -1890,6 +1894,9 @@ do_set_option_numeric(
|
|||||||
int i;
|
int i;
|
||||||
char *errmsg = NULL;
|
char *errmsg = NULL;
|
||||||
|
|
||||||
|
if (opt_idx < 0 || varp == NULL)
|
||||||
|
return NULL; // "cannot happen"
|
||||||
|
//
|
||||||
/*
|
/*
|
||||||
* Different ways to set a number option:
|
* Different ways to set a number option:
|
||||||
* & set to default value
|
* & set to default value
|
||||||
@@ -2209,8 +2216,8 @@ do_set_option(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* allow '=' and ':' for historical reasons (MSDOS command.com
|
* Allow '=' and ':' for historical reasons (MSDOS command.com).
|
||||||
* allows only one '=' character per "set" command line. grrr. (jw)
|
* Allows only one '=' character per "set" command line. grrr. (jw)
|
||||||
*/
|
*/
|
||||||
if (nextchar == '?'
|
if (nextchar == '?'
|
||||||
|| (prefix == PREFIX_NONE
|
|| (prefix == PREFIX_NONE
|
||||||
|
@@ -695,6 +695,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1286,
|
||||||
/**/
|
/**/
|
||||||
1285,
|
1285,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user