[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: findutils-4.1: locate can SEGV (+fix)
From: |
Stepan Kasal |
Subject: |
Re: findutils-4.1: locate can SEGV (+fix) |
Date: |
Fri, 10 Jan 2003 08:24:14 +0100 |
User-agent: |
Mutt/1.2.5.1i |
Hello,
thank for your bug report.
I'm not sure whether you consider this a mistake or not, so I'll answer
anyway.
On Thu, Jan 09, 2003 at 01:50:38PM -0500, Ken Lalonde wrote:
> --- /tmp/k/o/findutils-4.1/lib/getline.c Fri Nov 4 10:16:50 1994
> +++ ./getline.c Thu Jan 9 13:41:57 2003
> @@ -77,7 +77,7 @@
> NUL-terminate the line buffer. */
>
> assert(*n - nchars_avail == read_pos - *lineptr);
> - if (nchars_avail < 1)
> + while (nchars_avail < 1)
> {
> if (*n > MIN_CHUNK)
> *n *= 2;
It's clear from the code that nchars_avail will be enlarged by at least
MIN_CHUNK. And we can suppose that nchars_avail was bigger than say -3,
so there is no reason for the while loop.
The condition should be chnaged to if (nchars_avail < 2), though.
(It's already in the development version.)
The real problem was elsewhere, as you immediately found out...
[ TO BE CONTINUED ]