summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-04-11 10:22:53 +0200
committerBram Moolenaar <Bram@vim.org>2014-04-11 10:22:53 +0200
commitb21a29be56fb0e125d9f736bfdef8dde5a1ceae0 (patch)
treeadcbd4fe997adef56418bf80566d40959b633726 /src
parente29b1feead084f19e862bd719f140a490e3ed7f2 (diff)
downloadvim-b21a29be56fb0e125d9f736bfdef8dde5a1ceae0.zip
updated for version 7.4.256
Problem: Using systemlist() may cause a crash and does not handle NUL characters properly. Solution: Increase the reference count, allocate memory by length. (Yasuhiro Matsumoto)
Diffstat (limited to 'src')
-rw-r--r--src/eval.c12
-rw-r--r--src/version.c2
2 files changed, 9 insertions, 5 deletions
diff --git a/src/eval.c b/src/eval.c
index 2014deb80..275ef4811 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -18334,16 +18334,17 @@ get_cmd_output_as_rettv(argvars, rettv, retlist)
for (i = 0; i < len; ++i)
{
start = res + i;
- for (end = start; i < len && *end != NL; ++end)
+ while (i < len && res[i] != NL)
++i;
+ end = res + i;
- s = vim_strnsave(start, (int)(end - start));
+ s = alloc((unsigned)(end - start + 1));
if (s == NULL)
goto errret;
- for (p = s, end = s + (end - start); p < end; ++p)
- if (*p == NUL)
- *p = NL;
+ for (p = s; start < end; ++p, ++start)
+ *p = *start == NUL ? NL : *start;
+ *p = NUL;
li = listitem_alloc();
if (li == NULL)
@@ -18356,6 +18357,7 @@ get_cmd_output_as_rettv(argvars, rettv, retlist)
list_append(list, li);
}
+ ++list->lv_refcount;
rettv->v_type = VAR_LIST;
rettv->vval.v_list = list;
list = NULL;
diff --git a/src/version.c b/src/version.c
index 180a89412..1c7c9ddfa 100644
--- a/src/version.c
+++ b/src/version.c
@@ -735,6 +735,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 256,
+/**/
255,
/**/
254,