Re: str_cmp / strcasecmp (strdup!)

From: Thomas Arp (t_arp@stofanet.dk)
Date: 09/04/02


From: "Mark Garringer" <zizazat@HOTMAIL.COM>
> >> I also made str_dup only exist if strdup doesn't.
> >
> >I don't think this is a good idea.  Part of the point of str_dup() is
that
> >it uses CircleMUD's memory management and thus exits with a descriptive
> >malloc() failure error rather than simply returning NULL and crashing.
>
> I hate to dust off a super old thread, but I am about to loose my mind
with
> some NULL crashing strdup crap!!!!!
>
> I'm running on SUSE 8.0, and I keep having problems with redit crashing if
> you try to save an empty room desc.

Actually I just fixed that bug yesterday myself. In genwld.c, in
copy_room_strings(), change:

 dest->description = strdup(source->description);
to
 dest->description = strdup(source->description ? source->description :
"<NULL>");

and the same with name.

Welcor

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT