Re: Bug in stock circle?

From: George (greerga@CIRCLEMUD.ORG)
Date: 03/20/98


On Fri, 20 Mar 1998, Paul Siegel wrote:

>if (GET_POS(victim) <= POS_DEAD) {
>    log("SYSERR: Attempt to damage a corpse.");
>    die(victim);
>    return;                     /* -je, 7/7/92 */
>  }
>
>Well, as I found out the hard way, this code won't ever be called.  When
>the violence loop is entered, if the code attempts to call the hit
>procedure on a victim who is already dead, the system crashes.  Shouldn't
>then the afformentioned code exist somewhere much earlier?  Perhaps in the

Nope, because the 'victim' has been free()'d by now anyway.  Thus you
reference random parts of memory and crash, your loop is wrong.

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST