summaryrefslogtreecommitdiffstats
path: root/src/job.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-08-28 12:30:12 +0200
committerBram Moolenaar <Bram@vim.org>2021-08-28 12:30:12 +0200
commit271906bc067a8f25422016665001d2e44cf618e2 (patch)
tree83fee8240a2be83f321c8cee236caa7afbb427fb /src/job.c
parent6024c0427ce1196344439997d5e41a6f8546368c (diff)
patch 8.2.3379: crash when using NULL jobv8.2.3379
Problem: Crash when using NULL job. Solution: Copy static string into buffer. (issue #8260)
Diffstat (limited to 'src/job.c')
-rw-r--r--src/job.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/job.c b/src/job.c
index 884bf64b85..afa9972a76 100644
--- a/src/job.c
+++ b/src/job.c
@@ -1983,7 +1983,10 @@ job_to_string_buf(typval_T *varp, char_u *buf)
char *status;
if (job == NULL)
- return (char_u *)"no process";
+ {
+ vim_snprintf((char *)buf, NUMBUFLEN, "no process");
+ return buf;
+ }
status = job->jv_status == JOB_FAILED ? "fail"
: job->jv_status >= JOB_ENDED ? "dead"
: "run";