Subject: Re: join (1)
To: None <current-users@NetBSD.ORG>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: current-users
Date: 12/22/1995 07:41:31
> I'm building ispell and join crashes [...]
You don't say what "crashes" means. I did notice join coredumping in
some circumstances, and generated a PR for it (bin/1356), which
according to my records is still open. If you're seeing coredumps from
join, you may want to look at that PR.
In case you're lazy, here's the patch in question. I'm not entirely
sure the < in the first return() shouldn't be <= instead...but this
certainly stops the coredumps, which as I recall were due to indexing
outside of the ->fields[] arrays.
--- OLD/usr.bin/join/join.c Thu Jan 1 00:00:00 1970
+++ NEW/usr.bin/join/join.c Thu Jan 1 00:00:00 1970
@@ -356,9 +356,9 @@
LINE *lp1, *lp2;
u_long fieldno1, fieldno2;
{
- if (lp1->fieldcnt < fieldno1)
+ if (lp1->fieldcnt <= fieldno1)
return (lp2->fieldcnt < fieldno2 ? 0 : 1);
- if (lp2->fieldcnt < fieldno2)
+ if (lp2->fieldcnt <= fieldno2)
return (-1);
return (strcmp(lp1->fields[fieldno1], lp2->fields[fieldno2]));
}
der Mouse
mouse@collatz.mcrcim.mcgill.edu