🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sources.bugs
Article #901

robots2

#901
From: oleg
Date: Sat, 22 Aug 1987 17:02
43 lines
1916 bytes
While playing the new robots game (posted recently to comp.sources.games),
I discovered that the game would coredump when checking "safety" of a teleport
destination.  

Not having much time to analyze the game, I put in a check for the validity of
the examined location before a call to "move()" and it seemed to have fixed 
the problem.  I am not sure if this is REALLY a correct fix, however, and there
may be more places where bounds checking needs to be done.  Just goes to show:
always compile with "-g" and never strip your executables until you are REALLY
sure... :-)  


*** good.c.orig	Thu Aug 13 15:02:21 1987
--- good.c	Thu Aug 13 15:03:43 1987
***************
*** 90,95
  				/* we are 2 steps out */
  				if( blocked(ty, tx, y, x))
  					continue;
  				move(ty+y,tx+x);
  				if ( abs(x) == 2 && abs(y) == 2
  							&& inch() == FROBOT){

--- 90,99 -----
  				/* we are 2 steps out */
  				if( blocked(ty, tx, y, x))
  					continue;
+ 				if ((ty+y) < 0 || (tx+x) < 0 || (ty+y) > VERT
+ 					|| (tx+x) > HORIZ) 
+ 					continue;
+ 
  				move(ty+y,tx+x);
  				if ( abs(x) == 2 && abs(y) == 2
  							&& inch() == FROBOT){



-- 
Oleg Kiselev  --  oleg@quad1.quad.com -- {...!psivax|seismo!gould}!quad1!oleg

DISCLAIMER: All grammatical and spelling errors are inserted deliberately to
test the software I am developing.  In fact, that is the only reason I am 
posting. Yeah, that's the ticket! All my postings are just test data! Yeah!!
Technical Details
Message-ID: <4230@ncoast.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!cbosgd!cwruecmp!hal!ncoast!oleg

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!cbosgd!cwruecmp!hal!ncoast!oleg
From: oleg@ncoast.UUCP
Newsgroups: comp.sources.bugs
Subject: robots2
Message-ID: <4230@ncoast.UUCP>
Date: Sat, 22-Aug-87 13:02:18 EDT
Article-I.D.: ncoast.4230
Posted: Sat Aug 22 13:02:18 1987
Date-Received: Sun, 23-Aug-87 19:38:35 EDT
Sender: allbery@ncoast.UUCP
Lines: 43