From: utzoo!decvax!cca!whm.arizona@Udel-Relay@sri-unix Newsgroups: net.unix-wizards Title: bug in cu locking code Article-I.D.: sri-unix.3220 Posted: Fri Sep 10 23:18:44 1982 Received: Sun Sep 12 02:45:21 1982 From: Bill MitchellDate: 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.