diff src/job.c @ 25686:838a0108a92d v8.2.3379

patch 8.2.3379: crash when using NULL job Commit: https://github.com/vim/vim/commit/271906bc067a8f25422016665001d2e44cf618e2 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 28 12:30:12 2021 +0200 patch 8.2.3379: crash when using NULL job Problem: Crash when using NULL job. Solution: Copy static string into buffer. (issue https://github.com/vim/vim/issues/8260)
author Bram Moolenaar <Bram@vim.org>
date Sat, 28 Aug 2021 12:45:06 +0200
parents 0082503ff2ff
children 92c424550367
line wrap: on
line diff
--- a/src/job.c
+++ b/src/job.c
@@ -1983,7 +1983,10 @@ job_to_string_buf(typval_T *varp, char_u
     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";