Haha OK florian@ On Thu, Sep 08, 2016 at 07:58:29AM +0000, Mark Lumsden wrote: > Source Joachim Nilsson: > > Coverity Scan found this interesting buglet. If read() fails the code, > before this patch, would trigger a "Negative array index write". > > ok? > > Index: region.c > =================================================================== > RCS file: /cvs/src/usr.bin/mg/region.c,v > retrieving revision 1.36 > diff -u -p -u -p -r1.36 region.c > --- region.c 8 Sep 2016 07:50:09 -0000 1.36 > +++ region.c 8 Sep 2016 07:56:14 -0000 > @@ -650,7 +650,7 @@ preadin(int fd, struct buffer *bp) > int len; > char buf[BUFSIZ], *p, *q; > > - if ((len = read(fd, buf, BUFSIZ - 1)) == 0) > + if ((len = read(fd, buf, BUFSIZ - 1)) <= 0) > return (FALSE); > > buf[len] = '\0'; >
-- I'm not entirely sure you are real.