Karsten Hopp 07b871
To: vim_dev@googlegroups.com
Karsten Hopp 07b871
Subject: Patch 7.4.2
Karsten Hopp 07b871
Fcc: outbox
Karsten Hopp 07b871
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 07b871
Mime-Version: 1.0
Karsten Hopp 07b871
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 07b871
Content-Transfer-Encoding: 8bit
Karsten Hopp 07b871
------------
Karsten Hopp 07b871
Karsten Hopp 07b871
Patch 7.4.256 (after 7.4.248)
Karsten Hopp 07b871
Problem:    Using systemlist() may cause a crash and does not handle NUL
Karsten Hopp 07b871
	    characters properly.
Karsten Hopp 07b871
Solution:   Increase the reference count, allocate memory by length. (Yasuhiro
Karsten Hopp 07b871
	    Matsumoto)
Karsten Hopp 07b871
Files:	    src/eval.c
Karsten Hopp 07b871
Karsten Hopp 07b871
Karsten Hopp 07b871
*** ../vim-7.4.255/src/eval.c	2014-04-05 21:28:50.667174384 +0200
Karsten Hopp 07b871
--- src/eval.c	2014-04-11 10:10:22.112217827 +0200
Karsten Hopp 07b871
***************
Karsten Hopp 07b871
*** 18334,18349 ****
Karsten Hopp 07b871
  	for (i = 0; i < len; ++i)
Karsten Hopp 07b871
  	{
Karsten Hopp 07b871
  	    start = res + i;
Karsten Hopp 07b871
! 	    for (end = start; i < len && *end != NL; ++end)
Karsten Hopp 07b871
  		++i;
Karsten Hopp 07b871
  
Karsten Hopp 07b871
! 	    s = vim_strnsave(start, (int)(end - start));
Karsten Hopp 07b871
  	    if (s == NULL)
Karsten Hopp 07b871
  		goto errret;
Karsten Hopp 07b871
  
Karsten Hopp 07b871
! 	    for (p = s, end = s + (end - start); p < end; ++p)
Karsten Hopp 07b871
! 		if (*p == NUL)
Karsten Hopp 07b871
! 		    *p = NL;
Karsten Hopp 07b871
  
Karsten Hopp 07b871
  	    li = listitem_alloc();
Karsten Hopp 07b871
  	    if (li == NULL)
Karsten Hopp 07b871
--- 18334,18350 ----
Karsten Hopp 07b871
  	for (i = 0; i < len; ++i)
Karsten Hopp 07b871
  	{
Karsten Hopp 07b871
  	    start = res + i;
Karsten Hopp 07b871
! 	    while (i < len && res[i] != NL)
Karsten Hopp 07b871
  		++i;
Karsten Hopp 07b871
+ 	    end = res + i;
Karsten Hopp 07b871
  
Karsten Hopp 07b871
! 	    s = alloc((unsigned)(end - start + 1));
Karsten Hopp 07b871
  	    if (s == NULL)
Karsten Hopp 07b871
  		goto errret;
Karsten Hopp 07b871
  
Karsten Hopp 07b871
! 	    for (p = s; start < end; ++p, ++start)
Karsten Hopp 07b871
! 		*p = *start == NUL ? NL : *start;
Karsten Hopp 07b871
! 	    *p = NUL;
Karsten Hopp 07b871
  
Karsten Hopp 07b871
  	    li = listitem_alloc();
Karsten Hopp 07b871
  	    if (li == NULL)
Karsten Hopp 07b871
***************
Karsten Hopp 07b871
*** 18356,18361 ****
Karsten Hopp 07b871
--- 18357,18363 ----
Karsten Hopp 07b871
  	    list_append(list, li);
Karsten Hopp 07b871
  	}
Karsten Hopp 07b871
  
Karsten Hopp 07b871
+ 	++list->lv_refcount;
Karsten Hopp 07b871
  	rettv->v_type = VAR_LIST;
Karsten Hopp 07b871
  	rettv->vval.v_list = list;
Karsten Hopp 07b871
  	list = NULL;
Karsten Hopp 07b871
*** ../vim-7.4.255/src/version.c	2014-04-10 20:00:03.720106386 +0200
Karsten Hopp 07b871
--- src/version.c	2014-04-11 09:44:05.208214383 +0200
Karsten Hopp 07b871
***************
Karsten Hopp 07b871
*** 736,737 ****
Karsten Hopp 07b871
--- 736,739 ----
Karsten Hopp 07b871
  {   /* Add new patch number below this line */
Karsten Hopp 07b871
+ /**/
Karsten Hopp 07b871
+     256,
Karsten Hopp 07b871
  /**/
Karsten Hopp 07b871
Karsten Hopp 07b871
-- 
Karsten Hopp 07b871
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 07b871
46. Your wife makes a new rule: "The computer cannot come to bed."
Karsten Hopp 07b871
Karsten Hopp 07b871
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 07b871
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 07b871
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 07b871
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///