[net.games.hack] Bug in Hack 1.0.3

b2@magic.UUCP (Bryan Bingham) (08/31/85)

> 
> Hi:
> 	I found a very annoying little bug in Hack 1.0.3. Ths bug involves the
> 'E' command. When you attempt to write a message with your finger (The E command
> with the '-' option) our Sun 2/170's generate a segmentation fault. Does anybody
> else have this problem with 'E' ???
> 
> 
> 	Harry Reed
> 	{allegra,hplabs,trwrb,ihnp4}!sdcrdcf!doon

      Yes, I found it too, it's our Old Friend, a reference to a zero pointer.
      You should make several minor changes in hack.engrave.c .  
      Here is the diff: 

142,144c142,147
< 	if(otmp == &zeroobj)
< 		otmp = 0;
< 	if(otmp->otyp == WAN_FIRE && otmp->spe) {
---
> 	if(otmp == &zeroobj) 
> 		/* Bug in Original? otmp= 0? 28 Aug 1985 b2 */
> 		otmp = (struct obj *) 0;
> 	/* BUG in original!  Didn't have otmp clause!  Bombed on Sun! b2 */
> 	
> 	if(otmp && otmp->otyp == WAN_FIRE && otmp->spe) {
190c193,194
< 		  oep = 0;
---
> 		  /* Possible bug! 27 Aug 85 b2 */
> 		  oep = (struct engr *) 0;
272c276,277
< 	head_engr = 0;
---
> 	/* Possible Bug! 27 Aug 1985 b2 */
> 	head_engr = (struct engr *) 0;
278c283,284
< 	head_engr = 0;
---
> 	/* Possible Bug! 27 Aug 1985 b2 */
> 	head_engr = (struct engr *) 0;

      This should clear up THAT problem.  I wouldn't be suprised to hear
      about other instances of exactly the same sort of bug scattered 
      throughout the code, but I'm just going to fix them as I come across
      them. Of course, I won't find any bugs until I'm in a personal best
      game, that's almost a law of nature.

      b2
      ihnp4!bellcore!b2
      b2%bellcore@mouton (for ARPA folks)