0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

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)
This commit is contained in:
Bram Moolenaar
2014-04-11 10:22:53 +02:00
parent e29b1feead
commit b21a29be56
2 changed files with 9 additions and 5 deletions

View File

@@ -18334,16 +18334,17 @@ get_cmd_output_as_rettv(argvars, rettv, retlist)
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
{ {
start = res + i; start = res + i;
for (end = start; i < len && *end != NL; ++end) while (i < len && res[i] != NL)
++i; ++i;
end = res + i;
s = vim_strnsave(start, (int)(end - start)); s = alloc((unsigned)(end - start + 1));
if (s == NULL) if (s == NULL)
goto errret; goto errret;
for (p = s, end = s + (end - start); p < end; ++p) for (p = s; start < end; ++p, ++start)
if (*p == NUL) *p = *start == NUL ? NL : *start;
*p = NL; *p = NUL;
li = listitem_alloc(); li = listitem_alloc();
if (li == NULL) if (li == NULL)
@@ -18356,6 +18357,7 @@ get_cmd_output_as_rettv(argvars, rettv, retlist)
list_append(list, li); list_append(list, li);
} }
++list->lv_refcount;
rettv->v_type = VAR_LIST; rettv->v_type = VAR_LIST;
rettv->vval.v_list = list; rettv->vval.v_list = list;
list = NULL; list = NULL;

View File

@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
256,
/**/ /**/
255, 255,
/**/ /**/