[net.unix-wizards] bug in cu locking code

whm.arizona@Udel-Relay@sri-unix (09/11/82)

From:     Bill Mitchell <whm.arizona@Udel-Relay>
Date:     8 Sep 82 18:26:47-MST (Wed)
I ran into a bug in the locking code in cu.c that doesn't seem to
normally cause any problems.  I extracted the locking code from
cu for use in another application.  I wrote a little routine to
test the locking, and when I ran it, I got a core dump.  It turned
out that malloc() was getting a bad register.  I printf'd around in
the code and I discovered that in ulockf(), there is a statement:
	sprintf(tempfile,"/usr/spool/uucp/LTMP.%d",pid);
where tempfile is char tempfile[NAMESIZE] and NAMESIZE is 15.  Of
course, "/usr/...." is larger than 15.  Increasing NAMESIZE fixed
the problem.  I checked the original uucp code and in it, the
sprintf is done using "LTMP.%d" as a format.

I guess the moral of the story is to not steal stolen code.