Blame SOURCES/7.4.256

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