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;