Patch 8.0.0636
Problem: When reading the undo file fails may use uninitialized data.
Solution: Always clear the buffer on failure.
Files: src/undo.c
*** ../vim-8.0.0635/src/undo.c 2017-03-16 17:23:26.839815753 +0100
--- src/undo.c 2017-06-11 23:03:10.198569279 +0200
***************
*** 1063,1068 ****
--- 1063,1070 ----
static int
undo_read(bufinfo_T *bi, char_u *buffer, size_t size)
{
+ int retval = OK;
+
#ifdef FEAT_CRYPT
if (bi->bi_buffer != NULL)
{
***************
*** 1078,1087 ****
n = fread(bi->bi_buffer, 1, (size_t)CRYPT_BUF_SIZE, bi->bi_fp);
if (n == 0)
{
! /* Error may be checked for only later. Fill with zeros,
! * so that the reader won't use garbage. */
! vim_memset(p, 0, size_todo);
! return FAIL;
}
bi->bi_avail = n;
bi->bi_used = 0;
--- 1080,1087 ----
n = fread(bi->bi_buffer, 1, (size_t)CRYPT_BUF_SIZE, bi->bi_fp);
if (n == 0)
{
! retval = FAIL;
! break;
}
bi->bi_avail = n;
bi->bi_used = 0;
***************
*** 1095,1106 ****
size_todo -= (int)n;
p += n;
}
- return OK;
}
#endif
if (fread(buffer, (size_t)size, 1, bi->bi_fp) != 1)
! return FAIL;
! return OK;
}
/*
--- 1095,1111 ----
size_todo -= (int)n;
p += n;
}
}
+ else
#endif
if (fread(buffer, (size_t)size, 1, bi->bi_fp) != 1)
! retval = FAIL;
!
! if (retval == FAIL)
! /* Error may be checked for only later. Fill with zeros,
! * so that the reader won't use garbage. */
! vim_memset(buffer, 0, size);
! return retval;
}
/*
*** ../vim-8.0.0635/src/version.c 2017-06-11 17:09:50.614252000 +0200
--- src/version.c 2017-06-11 23:04:09.074198894 +0200
***************
*** 766,767 ****
--- 766,769 ----
{ /* Add new patch number below this line */
+ /**/
+ 636,
/**/
--
I'm not familiar with this proof, but I'm aware of a significant
following of toddlers who believe that peanut butter is the solution
to all of life's problems... -- Tim Hammerquist
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ 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].
For more options, visit https://groups.google.com/d/optout.