Karsten Hopp 39bddf
To: vim_dev@googlegroups.com
Karsten Hopp 39bddf
Subject: Patch 7.4.660
Karsten Hopp 39bddf
Fcc: outbox
Karsten Hopp 39bddf
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 39bddf
Mime-Version: 1.0
Karsten Hopp 39bddf
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 39bddf
Content-Transfer-Encoding: 8bit
Karsten Hopp 39bddf
------------
Karsten Hopp 39bddf
Karsten Hopp 39bddf
Patch 7.4.660
Karsten Hopp 39bddf
Problem:    Using freed memory when g:colors_name is changed in the colors
Karsten Hopp 39bddf
	    script. (oni-link)
Karsten Hopp 39bddf
Solution:   Make a copy of the variable value.
Karsten Hopp 39bddf
Files:	    src/syntax.c
Karsten Hopp 39bddf
Karsten Hopp 39bddf
Karsten Hopp 39bddf
*** ../vim-7.4.659/src/syntax.c	2015-02-03 13:00:34.404529640 +0100
Karsten Hopp 39bddf
--- src/syntax.c	2015-03-13 12:48:03.203291145 +0100
Karsten Hopp 39bddf
***************
Karsten Hopp 39bddf
*** 6988,6995 ****
Karsten Hopp 39bddf
       * and 'background' or 't_Co' is changed.
Karsten Hopp 39bddf
       */
Karsten Hopp 39bddf
      p = get_var_value((char_u *)"g:colors_name");
Karsten Hopp 39bddf
!     if (p != NULL && load_colors(p) == OK)
Karsten Hopp 39bddf
! 	return;
Karsten Hopp 39bddf
  #endif
Karsten Hopp 39bddf
  
Karsten Hopp 39bddf
      /*
Karsten Hopp 39bddf
--- 6988,7009 ----
Karsten Hopp 39bddf
       * and 'background' or 't_Co' is changed.
Karsten Hopp 39bddf
       */
Karsten Hopp 39bddf
      p = get_var_value((char_u *)"g:colors_name");
Karsten Hopp 39bddf
!     if (p != NULL)
Karsten Hopp 39bddf
!     {
Karsten Hopp 39bddf
!        /* The value of g:colors_name could be freed when sourcing the script,
Karsten Hopp 39bddf
! 	* making "p" invalid, so copy it. */
Karsten Hopp 39bddf
!        char_u *copy_p = vim_strsave(p);
Karsten Hopp 39bddf
!        int    r;
Karsten Hopp 39bddf
! 
Karsten Hopp 39bddf
!        if (copy_p != NULL)
Karsten Hopp 39bddf
!        {
Karsten Hopp 39bddf
! 	   r = load_colors(copy_p);
Karsten Hopp 39bddf
! 	   vim_free(copy_p);
Karsten Hopp 39bddf
! 	   if (r == OK)
Karsten Hopp 39bddf
! 	       return;
Karsten Hopp 39bddf
!        }
Karsten Hopp 39bddf
!     }
Karsten Hopp 39bddf
! 
Karsten Hopp 39bddf
  #endif
Karsten Hopp 39bddf
  
Karsten Hopp 39bddf
      /*
Karsten Hopp 39bddf
*** ../vim-7.4.659/src/version.c	2015-03-13 11:23:46.446245826 +0100
Karsten Hopp 39bddf
--- src/version.c	2015-03-13 12:50:42.297597991 +0100
Karsten Hopp 39bddf
***************
Karsten Hopp 39bddf
*** 743,744 ****
Karsten Hopp 39bddf
--- 743,746 ----
Karsten Hopp 39bddf
  {   /* Add new patch number below this line */
Karsten Hopp 39bddf
+ /**/
Karsten Hopp 39bddf
+     660,
Karsten Hopp 39bddf
  /**/
Karsten Hopp 39bddf
Karsten Hopp 39bddf
-- 
Karsten Hopp 39bddf
This is the polymorph virus!  Follow these instructions carefully:
Karsten Hopp 39bddf
1. Send this message to everybody you know.
Karsten Hopp 39bddf
2. Format your harddisk.
Karsten Hopp 39bddf
Thank you for your cooperation in spreading the most powerful virus ever!
Karsten Hopp 39bddf
Karsten Hopp 39bddf
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 39bddf
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 39bddf
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 39bddf
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///