[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug in findutils-4.1/locate
From: |
Jeff Morriss |
Subject: |
bug in findutils-4.1/locate |
Date: |
Wed, 20 Dec 2000 20:50:11 -0500 (EST) |
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
- bug in findutils-4.1/locate,
Jeff Morriss <=