Skip to content

Commit dc47649

Browse files
committed
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)
1 parent 090b028 commit dc47649

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/eval.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18334,16 +18334,17 @@ get_cmd_output_as_rettv(argvars, rettv, retlist)
1833418334
for (i = 0; i < len; ++i)
1833518335
{
1833618336
start = res + i;
18337-
for (end = start; i < len && *end != NL; ++end)
18337+
while (i < len && res[i] != NL)
1833818338
++i;
18339+
end = res + i;
1833918340

18340-
s = vim_strnsave(start, (int)(end - start));
18341+
s = alloc((unsigned)(end - start + 1));
1834118342
if (s == NULL)
1834218343
goto errret;
1834318344

18344-
for (p = s, end = s + (end - start); p < end; ++p)
18345-
if (*p == NUL)
18346-
*p = NL;
18345+
for (p = s; start < end; ++p, ++start)
18346+
*p = *start == NUL ? NL : *start;
18347+
*p = NUL;
1834718348

1834818349
li = listitem_alloc();
1834918350
if (li == NULL)
@@ -18356,6 +18357,7 @@ get_cmd_output_as_rettv(argvars, rettv, retlist)
1835618357
list_append(list, li);
1835718358
}
1835818359

18360+
++list->lv_refcount;
1835918361
rettv->v_type = VAR_LIST;
1836018362
rettv->vval.v_list = list;
1836118363
list = NULL;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ static char *(features[]) =
734734

735735
static int included_patches[] =
736736
{ /* Add new patch number below this line */
737+
/**/
738+
256,
737739
/**/
738740
255,
739741
/**/

0 commit comments

Comments
 (0)