STRCPY/STRNCPY doesn't copy bytes after 0x00. diff -r dd44a527c2bd src/eval.c --- a/src/eval.c Sun Apr 06 21:34:04 2014 +0200 +++ b/src/eval.c Wed Apr 09 19:53:47 2014 +0900 @@ -18319,7 +18319,7 @@ char_u *s = NULL; char_u *start; char_u *end; - char_u *p; + char_u *p, *t; int i; res = get_cmd_output(get_tv_string(&argvars[0]), infile, @@ -18337,13 +18337,13 @@ for (end = start; i < len && *end != NL; ++end) ++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, end = s + (end - start), t = start; p < end; ++p, ++t) + *p = *t == NUL ? NL : *t; + *p= NUL; li = listitem_alloc(); if (li == NULL) @@ -18356,6 +18356,7 @@ list_append(list, li); } + ++list->lv_refcount; rettv->v_type = VAR_LIST; rettv->vval.v_list = list; list = NULL;
-- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.