dtree bugfix

Dave Borman borman at decvax.UUCP
Tue Feb 21 08:02:19 AEST 1984


Well, here's the first bug in dtree, version 2.3

Line #366 should be changed from
		sprintf(sub, "%s", dp->d_name);
to
		sprintf(sub, "%.*s", MAXNAMLEN, dp->d_name);

This bug shows up on non-4.2 systems, where dp->d_name will not be
null terminated if the name is exactly 14 characters long. In this
case is runs off the end of the buffer, scribbling over other data
areas, (like our open FILE pointer) and you get a very quick memory
fault. Thanks to Roger Noe and Larry Landis for bringing this to
my attention.

Another bug that is not critical is the fact that I have a structure
named "entry" which is a reserved C word.  None of the compilers I
have used have enforced this since it is not used, but I guess there
are some compilers out there that don't like you to use "entry". If
you are on a machine like that (like the Apollo) you just need to go
through the code an change all the references to "entry" to something
else like "dentry" and then things should work. Thanks to Jim Rees
for pointing this out.

That takes care of all the problems with dtree v2.3 that I know of.
If anyone on a 4.1c or 4.2 system can come up with an elegant solution
for the long directory name bug I mentioned in the manual page, I
would be thrilled to see it.

		-Dave Borman, Digital UNIX* Engineering Group
		decvax!borman

*UNIX is a trademark of AT&T Bell Labs



More information about the Comp.unix.wizards mailing list