🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.games.hack
Article #423

Re: wand of core dumping

#423
From: Andries Brouwer
Date: Wed, 10 Apr 1985 16:28
36 lines
2142 bytes
In article <774@unmvax.UUCP> cliff@unmvax.UUCP writes:
> Lately I haven't been able to get mail to mcvax.  This letter concerns
> hack 1.0.  On our SUN, wands of wishing cause core dumps when items are
> misspelled.  I found the problem to be related to NROFOBJECTS being defined
> improperly.  My quick patch was to change the following line (we are still
> running hack 1.0).
> 
> 436c436
> < 	while(i <= NROFOBJECTS && (!let || objects[i].oc_olet == let)){
> ---
> > 	while(objects[i].oc_name && (!let || objects[i].oc_olet == let)){

Thanks for the bug report; in fact your letter reached me, but perhaps my
reply failed to reach you. Anyway, I don't think there is anything wrong
with NROFOBJECTS, the problem is rather that strcmp(p,q) is done where q
may be 0. Your attempt at a fix only solves part of the problem - a core
dump is still possible - while on the other hand it makes asking for certain
objects impossible. I think the following would be better (the line numbers
are from hack.objnam.c version 1.0.2 but the fix works equally well on
earlier versions).
# diff hack.objnam.c (new)  hack.objnam.c (old)
498,501c498
< 		register char *zn = objects[i].oc_name;
< 
< 		if(!zn) goto nxti;
< 		if(an && strcmp(an, zn))
---
> 		if(an && strcmp(an, objects[i].oc_name))
503c500
< 		if(dn && (!(zn = objects[i].oc_descr) || strcmp(dn, zn)))
---
> 		if(dn && strcmp(dn, objects[i].oc_descr))
505c502
< 		if(un && (!(zn = objects[i].oc_uname) || strcmp(un, zn)))
---
> 		if(un && strcmp(un, objects[i].oc_uname))
Technical Details
Message-ID: <590@mcvax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!seismo!mcvax!aeb
References: <774@unmvax.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83 (MC840302); site mcvax.UUCP
Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!seismo!mcvax!aeb
From: aeb@mcvax.UUCP (Andries Brouwer)
Newsgroups: net.games.hack
Subject: Re: wand of core dumping
Message-ID: <590@mcvax.UUCP>
Date: Wed, 10-Apr-85 11:28:18 EST
Article-I.D.: mcvax.590
Posted: Wed Apr 10 11:28:18 1985
Date-Received: Fri, 12-Apr-85 06:56:52 EST
References: <774@unmvax.UUCP>
Reply-To: aeb@mcvax.UUCP (Andries Brouwer)
Distribution: net
Organization: CWI, Amsterdam
Lines: 36