From 3928acb032b64941afa9b3e75fa82cf004fb243b Mon Sep 17 00:00:00 2001 From: Scott Prager Date: Sun, 21 Sep 2014 22:39:04 -0400 Subject: Fix system() output truncation bug. Replace NULs with SOH to restore the old behaviour of get_cmd_output(). --- src/nvim/eval.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index bfe39ced0c..235f7526c2 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -14480,6 +14480,9 @@ static void get_system_output_as_rettv(typval_T *argvars, typval_T *rettv, free(res); } else { + // res may contain several NULs before the final terminating one. + // Replace them with SOH (1) like in get_cmd_output() to avoid truncation. + memchrsub(res, NUL, 1, nread); #ifdef USE_CRNL // translate into char *d = res; -- cgit