Patch 8.2.3331
Problem:    Coverity warns for using value without boundary check.
Solution:   Add a boundary check.
Files:      src/viminfo.c


*** ../vim-8.2.3330/src/viminfo.c       2021-08-08 15:43:30.109238223 +0200
--- src/viminfo.c       2021-08-11 17:13:44.532663626 +0200
***************
*** 253,269 ****
      int               off,                // offset for virp->vir_line
      int               convert UNUSED)     // convert the string
  {
!     char_u    *retval;
      char_u    *s, *d;
      long      len;
  
      if (virp->vir_line[off] == Ctrl_V && vim_isdigit(virp->vir_line[off + 1]))
      {
        len = atol((char *)virp->vir_line + off + 1);
!       retval = lalloc(len, TRUE);
        if (retval == NULL)
        {
!           // Line too long?  File messed up?  Skip next line.
            (void)vim_fgets(virp->vir_line, 10, virp->vir_fd);
            return NULL;
        }
--- 253,270 ----
      int               off,                // offset for virp->vir_line
      int               convert UNUSED)     // convert the string
  {
!     char_u    *retval = NULL;
      char_u    *s, *d;
      long      len;
  
      if (virp->vir_line[off] == Ctrl_V && vim_isdigit(virp->vir_line[off + 1]))
      {
        len = atol((char *)virp->vir_line + off + 1);
!       if (len > 0 && len < 1000000)
!           retval = lalloc(len, TRUE);
        if (retval == NULL)
        {
!           // Invalid length, line too long, out of memory?  Skip next line.
            (void)vim_fgets(virp->vir_line, 10, virp->vir_fd);
            return NULL;
        }
*** ../vim-8.2.3330/src/version.c       2021-08-11 17:01:41.614253926 +0200
--- src/version.c       2021-08-11 17:13:07.540763021 +0200
***************
*** 757,758 ****
--- 757,760 ----
  {   /* Add new patch number below this line */
+ /**/
+     3331,
  /**/

-- 
There are three kinds of people: Those who can count & those who can't.

 /// 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/202108111514.17BFElpI2944928%40masaka.moolenaar.net.

Raspunde prin e-mail lui