[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug in findutils-4.1/locate
From: |
Jeff Morriss |
Subject: |
Re: bug in findutils-4.1/locate |
Date: |
Thu, 21 Dec 2000 09:37:15 -0500 (EST) |
Hi,
: Without this fix 'locate' will seg-fault whenever it encounters a
: negative 'diffcount'.
Naturally I mean "a 'diffcount' < -127", not just ANY negative
'diffcount'... I shouldn't work so late; then my mind would work better
;).
Cheers,
-Jeff
On Wed, 20 Dec 2000, Jeff Morriss wrote:
: Date: Wed, 20 Dec 2000 20:50:11 -0500 (EST)
: From: Jeff Morriss <address@hidden>
: To: address@hidden
: Subject: bug in findutils-4.1/locate
:
:
: Hi,
:
: I found a bug in findutils-4.1/locate/locate.c .
:
: According to the code in "locate/frcode.c" here:
:
: if (diffcount < -127 || diffcount > 127)
: {
: putc (LOCATEDB_ESCAPE, stdout);
: put_short (diffcount, stdout);
: }
:
: 'diffcount' can be positive or negative. That's fine except that when
: 'locate' goes to read it in ("locate/locate.c"):
:
: if (c == LOCATEDB_ESCAPE)
: count += get_short (fp);
:
:
: 'get_short()' (also in "locate/locate.c"), though, returns an int. It
: needs to be changed to return a 'short int' so that it will work when the
: diffcount is negative. Here's the diff:
:
: [--- locate/locate.c.orig Wed Dec 20 20:42:22 2000
: +++ locate/locate.c Wed Dec 20 20:41:23 2000
: @@ -96,7 +96,7 @@
:
: /* Read in a 16-bit int, high byte first (network byte order). */
:
: -static int
: +static short int
: get_short (fp)
: FILE *fp;
: {
:
:
:
: Without this fix 'locate' will seg-fault whenever it encounters a negative
: 'diffcount'.
:
: Hope this helps!
:
: Regards,
: -Jeff
:
:
--
Robert "Jeff"rey Morriss Product Support Engineer (by day)
address@hidden Ulticom (Mount Laurel, NJ; USA)
http://www.pobox.com/~morriss #include<std/disclaimer.h>
PGP key on public key servers; Linux: the choice of a GNU generation