From 271906bc067a8f25422016665001d2e44cf618e2 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 28 Aug 2021 12:30:12 +0200 Subject: patch 8.2.3379: crash when using NULL job Problem: Crash when using NULL job. Solution: Copy static string into buffer. (issue #8260) --- src/job.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/job.c') diff --git a/src/job.c b/src/job.c index 884bf64b8..afa9972a7 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"; -- cgit v1.2.1