From 38dc59907b50f1717b3634ab3a99499a52819e3f Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Mon, 5 Jan 2015 14:00:01 +0100 Subject: 34120: compctl, jobs: Check contents instead of array text is an array in the struct, and can never be null. Found by Coverity (Issue 1255780). --- ChangeLog | 3 +++ Src/Zle/compctl.c | 2 +- Src/jobs.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6698da345..688ad8d44 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-01-06 Mikael Magnusson + * 34120: Src/Zle/compctl.c, Src/jobs.c: Check contents instead + of array + * 34108: Src/utils.c: Don't leak ifs stuff * 34107: Src/hist.c: getsubsargs: free ptr1 before returning diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c index 96ad6a280..2a80e6c84 100644 --- a/Src/Zle/compctl.c +++ b/Src/Zle/compctl.c @@ -3685,7 +3685,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd) for (i = 0; i <= maxjob; i++) if ((jobtab[i].stat & STAT_INUSE) && - jobtab[i].procs && jobtab[i].procs->text) { + jobtab[i].procs && jobtab[i].procs->text[0]) { int stopped = jobtab[i].stat & STAT_STOPPED; j = dupstring(jobtab[i].procs->text); diff --git a/Src/jobs.c b/Src/jobs.c index c6e1bce15..295f4c939 100644 --- a/Src/jobs.c +++ b/Src/jobs.c @@ -2718,7 +2718,7 @@ findjobnam(const char *s) for (jobnum = maxjob; jobnum >= 0; jobnum--) if (!(jobtab[jobnum].stat & (STAT_SUBJOB | STAT_NOPRINT)) && jobtab[jobnum].stat && jobtab[jobnum].procs && jobnum != thisjob && - jobtab[jobnum].procs->text && strpfx(s, jobtab[jobnum].procs->text)) + jobtab[jobnum].procs->text[0] && strpfx(s, jobtab[jobnum].procs->text)) return jobnum; return -1; } -- cgit 1.4.1