1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 10:01:11 +02:00

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).
This commit is contained in:
Mikael Magnusson 2015-01-05 14:00:01 +01:00
parent c425cc9632
commit 38dc59907b
3 changed files with 5 additions and 2 deletions

View file

@ -1,5 +1,8 @@
2015-01-06 Mikael Magnusson <mikachu@gmail.com>
* 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

View file

@ -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);

View file

@ -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;
}