sh: Don't add something to a null pointer
Pointer arithmetic on a null pointer is undefined behavior. The bug can be reproduced by running bin/sh/tests/builtins/wait6.0 with UBSAN. Reported by: Mark Millard Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D34011
This commit is contained in:
parent
ddf312e8d7
commit
5a1a07f2a0
@ -587,6 +587,8 @@ waitcmdloop(struct job *job)
|
||||
return retval;
|
||||
}
|
||||
} else {
|
||||
if (njobs == 0)
|
||||
return 0;
|
||||
for (jp = jobtab ; jp < jobtab + njobs; jp++)
|
||||
if (jp->used && jp->state == JOBDONE) {
|
||||
if (! iflag || ! jp->changed)
|
||||
|
Loading…
Reference in New Issue
Block a user