aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Prager <splinterofchaos@gmail.com>2014-09-21 22:39:04 -0400
committerScott Prager <splinterofchaos@gmail.com>2014-09-30 19:35:47 -0400
commit3928acb032b64941afa9b3e75fa82cf004fb243b (patch)
tree649b3319d2f6478940a33317420a0dd2569c9867
parent44b187dd012a3f5f01d58adbcbad4004e948e35a (diff)
downloadrneovim-3928acb032b64941afa9b3e75fa82cf004fb243b.tar.gz
rneovim-3928acb032b64941afa9b3e75fa82cf004fb243b.tar.bz2
rneovim-3928acb032b64941afa9b3e75fa82cf004fb243b.zip
Fix system() output truncation bug.
Replace NULs with SOH to restore the old behaviour of get_cmd_output().
-rw-r--r--src/nvim/eval.c3
1 files changed, 3 insertions, 0 deletions
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 <CR><NL> into <NL>
char *d = res;