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