Patch 8.2.3247
Problem:    Using uninitialized memory when checking for crypt method.
Solution:   Check the header length before using the salt and seed.
Files:      src/fileio.c


*** ../vim-8.2.3246/src/fileio.c        2021-07-29 20:37:45.652199179 +0200
--- src/fileio.c        2021-07-29 21:21:22.658150211 +0200
***************
*** 2917,2931 ****
        {
            int header_len;
  
-           curbuf->b_cryptstate = crypt_create_from_header(
-                                                      method, cryptkey, ptr);
-           crypt_set_cm_option(curbuf, method);
- 
-           // Remove cryptmethod specific header from the text.
            header_len = crypt_get_header_len(method);
            if (*sizep <= header_len)
                // invalid header, buffer can't be encrypted
                return NULL;
            *filesizep += header_len;
            *sizep -= header_len;
            mch_memmove(ptr, ptr + header_len, (size_t)*sizep);
--- 2917,2932 ----
        {
            int header_len;
  
            header_len = crypt_get_header_len(method);
            if (*sizep <= header_len)
                // invalid header, buffer can't be encrypted
                return NULL;
+ 
+           curbuf->b_cryptstate = crypt_create_from_header(
+                                                       method, cryptkey, ptr);
+           crypt_set_cm_option(curbuf, method);
+ 
+           // Remove cryptmethod specific header from the text.
            *filesizep += header_len;
            *sizep -= header_len;
            mch_memmove(ptr, ptr + header_len, (size_t)*sizep);
*** ../vim-8.2.3246/src/version.c       2021-07-29 21:11:26.815533418 +0200
--- src/version.c       2021-07-29 21:23:32.625850511 +0200
***************
*** 757,758 ****
--- 757,760 ----
  {   /* Add new patch number below this line */
+ /**/
+     3247,
  /**/

-- 
Ten bugs in the hand is better than one as yet undetected.

 /// 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/202107291926.16TJQKQt2226348%40masaka.moolenaar.net.

Raspunde prin e-mail lui