patch 8.2.3379: crash when using NULL job

Problem:    Crash when using NULL job.
Solution:   Copy static string into buffer. (issue #8260)
This commit is contained in:
Bram Moolenaar
2021-08-28 12:30:12 +02:00
parent 6024c0427c
commit 271906bc06
3 changed files with 10 additions and 1 deletions
+4 -1
View File
@@ -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";