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 -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230206164116.403DE1C0492%40moolenaar.net.

Raspunde prin e-mail lui