Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!mfci!karzes From: karzes@mfci.UUCP (Tom Karzes) Newsgroups: comp.sources.games.bugs Subject: ularn bug Message-ID: <971@m3.mfci.UUCP> Date: 31 Jul 89 23:10:16 GMT Sender: karzes@mfci.UUCP Reply-To: karzes@mfci.UUCP (Tom Karzes) Organization: Multiflow Computer Inc., Branford Ct. 06405 Lines: 60 References: When running ularn on one of our machines, I noticed a few instances where mistyping the name of a spell caused an addressing error. It turns out that there are a few places in the code where the list of spells is incorrectly searched, resulting in an attempt to index past the end of the array. There are SPNUM spells, numbered from 0 to SPNUM-1. In a couple places in monster.c and one place in object.c, the spells are incorrectly treated as being numbered from 0 to SPNUM, inclusive, for a total of SPNUM+1 spells. This obviously doesn't work. In function "cast" in monster.c we have: for (lprc('\n'),j= -1,i=0; i=SPNUM+1) return; /* no such spell */ This should be: if (x>=SPNUM) return; /* no such spell */ Finally, in the brass lamp code in function "lookforobject" in object.c we have: for (lprc('\n'),i=0; i