Bug in "comm" utility
Doug Gwyn
gwyn at smoke.BRL.MIL
Wed Jun 14 01:53:14 AEST 1989
As you can see in the excerpt below, the UNIX "comm" utility makes a
non-portable assumption about pointer arithmetic in its compare() function.
Here is the quick fix I devised for the UNIX System V Release 2.0 source;
other versions of "comm" appear to be similar.
static char sccsid[] = "@(#)comm.c 1.2";
...
main(argc,argv)
char **argv;
{
int l;
char xlb1[LB+1],xlb2[LB+1]; /* DAG: allow for -- in compare() */
#define lb1 (&xlb1[1])
#define lb2 (&xlb2[1])
...
compare(a,b)
char *a,*b;
{
register char *ra,*rb;
ra = --a;
rb = --b;
...
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list