Patch 8.1.1825
Problem:    Allocating more memory than needed for extended structs.
Solution:   Use offsetof() instead of sizeof(). (Dominique Pelle,
            closes #4785)
Files:      src/dict.c


*** ../vim-8.1.1824/src/dict.c  2019-07-27 23:12:08.667924110 +0200
--- src/dict.c  2019-08-07 21:34:26.138992400 +0200
***************
*** 210,216 ****
  {
      dictitem_T *di;
  
!     di = alloc(sizeof(dictitem_T) + STRLEN(key));
      if (di != NULL)
      {
        STRCPY(di->di_key, key);
--- 210,216 ----
  {
      dictitem_T *di;
  
!     di = alloc(offsetof(dictitem_T, di_key) + STRLEN(key) + 1);
      if (di != NULL)
      {
        STRCPY(di->di_key, key);
***************
*** 228,234 ****
  {
      dictitem_T *di;
  
!     di = alloc(sizeof(dictitem_T) + STRLEN(org->di_key));
      if (di != NULL)
      {
        STRCPY(di->di_key, org->di_key);
--- 228,234 ----
  {
      dictitem_T *di;
  
!     di = alloc(offsetof(dictitem_T, di_key) + STRLEN(org->di_key) + 1);
      if (di != NULL)
      {
        STRCPY(di->di_key, org->di_key);
*** ../vim-8.1.1824/src/version.c       2019-08-06 22:47:57.112635782 +0200
--- src/version.c       2019-08-07 21:36:19.770401825 +0200
***************
*** 771,772 ****
--- 771,774 ----
  {   /* Add new patch number below this line */
+ /**/
+     1825,
  /**/

-- 
The technology involved in making anything invisible is so infinitely
complex that nine hundred and ninety-nine billion, nine hundred and
ninety-nine million, nine hundred and ninety-nine thousand, nine hundred
and ninety-nine times out of a trillion it is much simpler and more
effective just to take the thing away and do without it.
                -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/201908071943.x77Jh2Dd028757%40masaka.moolenaar.net.

Raspunde prin e-mail lui