Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, DotBot, Yahoo!

Members: 0
Guests: 16
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
612
Jacki72H
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » AFKMud Bugfix List » AFKMud Bug Archive » [Bug] New polymorphs can caus...
Forum Rules | Mark all | Recent Posts

[Bug] New polymorphs can cause crashes with no short desc set
< Newer Topic :: Older Topic > AFKMud 1.76a

Pages:<< prev 1 next >>
Post is unread #1 Dec 3, 2005, 6:47 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Bug: New polymorphs can cause crashes with no short desc set
Discovered in: AFKMud 1.76a
Danger: Critical - Crash bug
Found by: Nick Gammon
Fixed by: Nick Gammon/Samson

---

comm.c, above act_string

Locate:
#define MORPHNAME(ch)   ((ch->morph&&ch->morph->morph)? \
                         ch->morph->morph->short_desc: \
                         IS_NPC(ch) ? ch->short_descr : ch->name)
#define NAME(ch)        ( IS_NPC(ch) ? ch->short_descr : ch->name )


Change to:
#define NAME(ch)        ( IS_NPC(ch) ? ch->short_descr : ch->name )

char *MORPHNAME( CHAR_DATA *ch )
{
   if( ch->morph && ch->morph->morph && ch->morph->morph->short_desc != NULL )
      return ch->morph->morph->short_desc;
   else
      return NAME(ch);
}


polymorph.c, do_morphcreate

Locate:
   if( argument && argument[0] != '\0' && !str_cmp( argument, "copy" ) && temp )
      copy_morph( morph, temp );
   else
      morph->name = str_dup( arg1 );


Change to:
   if( argument && argument[0] != '\0' && !str_cmp( argument, "copy" ) && temp )
      copy_morph( morph, temp );
   else
      morph->name = str_dup( arg1 );
   if( !morph->short_desc || morph->short_desc[0] == '\0' )
      morph->short_desc = str_dup( arg1 );


A newly created morph with no items set will not have a short description. Without a short description the MORPHNAME macro will not work when a morphed immortal uses the goto command. Probably other scenarios where this would crash as well. Additionally, the MORPHNAME macro looked tweaked, so it has been changed to a function instead.

An interesting note though - the macro fix fails to do anything to solve the problem of a morphed imm using goto. It will still crash. Valgrind still says the affected variable is NULL. The MORPHNAME function is only called on 2 particular cases, for $N and $n act strings. That code path is never executed at the point of the crash. So the second change in polymorph.c is ALSO necessary to stop this.

Preexisting morphs which do not have short descriptions set will need to be fixed using the morph editing commands.
       
Pages:<< prev 1 next >>