bin/77031: [patch] comm(1) unable to handle lines greater than LINE_MAX (2048)

Mario Hoerich lists at MHoerich.de
Fri Feb 4 12:16:46 PST 2005


# Fergus Cameron:
>  	http://people.freebsd.org/~keramida/fergus/comm.c-diff

Ok, I must admit your patch _is_ far easier on the malloc(3)
side than the one I posted to -current a while back. I've
briefly considered to rewrite it, but since your's was the
only feedback I got (thanks btw) there's probably not much
interest in my solution anyway. Oh well.

Now to your patch. What I've noticed while doing a preliminary
review (bit short on time right now) was:
    file1 = file( argv[0] ) ;
	file2 = file( argv[1] ) ;

	if( file1 == file2 )
		errx( EXIT_FAILURE,
				"cannot match file against self" ) ;

You sure this is guaranteed to trigger? I'm not standard-
savvy enough to know for sure, but it seems like a potential
problem. Anyone with a definitive answer?

In addition to that, how does fgetws_a() cope with files, which
have no '\n' in their last line? (They should of course, but every
once in a while some file has not.) I might be wrong here, but
it seems the do { ... } while (line_p) doesn't terminate properly
in that case. Just scanning through though, might have missed
something.

Regards,
Mario


More information about the freebsd-bugs mailing list