I patched in the $p no problem then I seen the following problem.

$p

  Problem

   Entering delete $p crashes the mud.

  Cause

   When a $p is printed on wiznet, it's expanded in act_new while it the
   information required by this expansing isn't available or valid. This
   can cause the mud to crash (it will most of the time).

  Checking

   Login in your mud, make sure you have wiznet on, login with another
   character, type delete $p. If your mud doesn't crash you're not
   vulnerable.

  Patch

   In interp.c/interpret(), replace

if ( ( !IS_NPC(ch) && IS_SET(ch->act, PLR_LOG) )
||   fLogAll
||   cmd_table[cmd].log == LOG_ALWAYS )
{
    sprintf( log_buf, "Log %s: %s", ch->name, logline );
    wiznet(log_buf,ch,NULL,WIZ_SECURE,0,get_trust(ch));
    log_string( log_buf );
}

   with

if ( ( !IS_NPC(ch) && IS_SET(ch->act, PLR_LOG) )
||   fLogAll
||   cmd_table[cmd].log == LOG_ALWAYS )
{
    char    s[2*MAX_INPUT_LENGTH],*ps;
    int     i;

    ps=s;
    sprintf( log_buf, "Log %s: %s", ch->name, logline );
    /* Make sure that was is displayed is what is typed */
    for (i=0;log_buf[i];i++) {
        *ps++=log_buf[i];
        if (log_buf[i]=='$')
            *ps++='$';
        if (log_buf[i]=='{')
            *ps++='{';
    }
    *ps=0;
    wiznet(s,ch,NULL,WIZ_LOGS,0,get_trust(ch));
    log_string( log_buf );
}
     _________________________________________________________________

More $

  Problem

   It seemed that the $-problem in the previous paragraph gave also
   problems in the act_new()-function, when you get a string with a $
   dollar in it. Perhaps the previous fix was not enough on it's on, with
   this is it.

  Cause

   In act_new(), it's assumed that all pointers are valid.

  Checking

   Take a mortal character, let him say "cast 'bless' $p" for about 40
   times and make sure you have the wiznet-spam option on. If your mud
   crashes you have to apply the following patch.

  Patch

   Check the pointers before using them:

   case 't': i = (char *) arg1;                            break;
   case 'T': i = (char *) arg2;                            break;
   case 'n': i = PERS( ch,  to  );                         break;
   case 'N': i = PERS( vch, to  );                         break;
   case 'e': i = he_she  [URANGE(0, ch  ->sex, 2)];        break;
   etc...

   should become

   case 't': if (arg1) i=(char *)arg1;
             else bug("Act: bad code $t for 'arg1'",0);
             break;
   case 'T': if (arg2) i=(char *)arg2;
             else bug("Act: bad code $T for 'arg2'",0);
             break;
   case 'n': if (ch&&to) i=PERS(ch,to);
             else bug("Act: bad code $n for 'ch' or 'to'",0);
             break;
   case 'N': if (vch&&to) i=PERS(vch,to);
             else bug("Act: bad code $N for 'ch' or 'to'",0);
             break;
   case 'e': if (ch) i=he_she[URANGE(0,ch->sex,2)];
             else bug("Act: bad code $e for 'ch'",0);
             break;
   etc...
             break;
             break;
             break; // BREAK IT! :-)

  Thanks

   Thanks to the guy from primenet for telling me the problem (although
   it was already fixed in our code :-)

      Okay this was all fine and dandy but one thing occured to me. Not all
the code in the cases were the same so I'm kinda stumped on this:

case 'p':
                    i = can_see_obj( to, obj1 )
                            ? obj1->short_descr
                            : "something";
                    break;

                case 'P':
                    i = can_see_obj( to, obj2 )
                            ? obj2->short_descr
                            : "something";
                    break;


or this:

case 'd':
                    if ( arg2 == NULL || ((char *) arg2)[0] == '\0' )
                    {
                        i = "door";
                    }
                    else
                    {
                        one_argument( (char *) arg2, fname );
                        i = fname;
                    }
                    break;

     Just want to get these to the above format could someone please help me
out? I'll send you my english translation of ivan's olc 2.01... Of course I
would send it to you anyways but at least its a fair trade... heheh Ah well
it was worth a try..

                                           Dantin

P.S. Thanks for any help before hand.



Reply via email to