Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!oliveb!felix!zemon From: chris@wiley.UUCP (Chris Stassen) Newsgroups: comp.unix.ultrix Subject: getdiskbyname(3x) crashes after repeated calls. Message-ID: <9434@felix.UUCP> Date: Tue, 13-Oct-87 19:40:22 EDT Article-I.D.: felix.9434 Posted: Tue Oct 13 19:40:22 1987 Date-Received: Fri, 16-Oct-87 04:58:37 EDT Sender: zemon@felix.UUCP Organization: The Lion's Den, Redondo Beach Lines: 25 Approved: zemon@felix.UUCP Reply-Path: I don't know if this has been mentioned before... we have found a bug in Ultrix 2.0 libc source that causes getdiskbyname(3x) to crash on the eighth invocation (or thereabouts). [line 13 of /usr/src/lib/libc/vax/gen/disktab.c:] < static char localbuf[100], *cp = localbuf; [should be:] > static char localbuf[100]; > char *cp = localbuf; cp gets incremented as various strings are stored in localbuf (within getdiskbyname()). When cp runs off the end of localbuf (8th call), the first value that gets wiped out is cp, and a core dump is caused. The problem is fixed by making cp "auto" (rather than "static"), which causes the initialization (cp = localbuf) to be performed on every call. [The strings stored in localbuf are pointed to from another static structure, which is overwritten with every call to getdiskbyname(), so re-initializing cp (and overwriting the strings from the last call) doesn't hurt.] -- Chris -- "Nothing succeeds like a parakeet | Chris Stassen with no teeth." -- Benny Hill | {trwrb|cit-vax}!wiley!chris