[CF-Devel] Re: [Crossfire-cvs] CVS commit: crossfire

crossfire-devel at archives.real-time.com crossfire-devel at archives.real-time.com
Tue Jan 4 13:07:08 CST 2005


On Tue, 4 Jan 2005 18:59:19 +0100, Andreas Kirschbaum  wrote:
>
     
      > Index: crossfire/server/main.c
     
     >
     
      [...]
     
     >
     
      >!     if (!(QUERY_FLAG(pl->ob,FLAG_WIZ) && pl->ob->contr->hidden) &&
     
     >
     
      >!         (pl!=NULL && draw_exit)) new_draw_info(NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, buf);
     
     
>
     
      This code seems rather "wrong" to me: all statements within the function
     
     >
     
      leave() (which is the enclosing function of this code fragment) check
     
     >
     
      "pl != NULL" before accessing pl. Therefore this statement will crash if
     
     >
     
      a NULL value would be passed. (On the other hand, I did not find any
     
     >
     
      caller that could possibly pass such a NULL value...)
     
     
There probably was or still is a reson for pl != NULL checks, maybe
the code should be something like:

     if (pl!=NULL && draw_exit) {
       if !(QUERY_FLAG(pl->ob,FLAG_WIZ) && pl->ob->contr->hidden)
               new_draw_info(NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5,
NULL, buf);
     }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.c.diff.gz
Type: application/x-perl
Size: 403 bytes
Desc: not available
Url : 
     
     http://shadowknight.real-time.com/pipermail/crossfire/attachments/20050104/b4096fa0/main.c.diff.bin
     
     
-------------- next part --------------
_______________________________________________
crossfire-devel mailing list
     
     crossfire-devel at lists.real-time.com
     
     
     https://mailman.real-time.com/mailman/listinfo/crossfire-devel
     
     
    


More information about the crossfire mailing list