Ahhh, I've had a crash when someone was link dead. Are you using Samson's color snippet? If its FUSS, the snippet is pre-installed.
K, the problem seems to be here:[
strncpy( code, ANSI_RESET, 20 ); /* Yes, this reset here is quite necessary to cancel out other things */
if( ch )
strncat( code, color_str( ch->desc->pagecolor, ch ), 20 );
break;
This is in colorcode, which is called from if( colstr > prevstr )
write_to_buffer( d, prevstr, ( colstr-prevstr ) );
ln = colorcode( colstr, colbuf, d->character );
Now, the version in the snippet is different from mine, as mine seems to be old, it uses ch->desc, not d, but I think the principle still stands. If during write_to_buffer, the buffer exceeds 32000( see comm.c, write_to_buffer ), the player is disconnecting, desctroying their descriptor data. Now, there is a check: if ( !txt || !d->descriptor )
but it is before this section. So if this particular block is too much, d is destroyed, and then passed on to colorcode. The pointer exists, so the d = NULL in close_connection doesn't close the pointer of d in this function. So this bad pointer may crash on d->character, since d is dead. However, in my version of the code, it gets to colorcode, since it is using ch->desc instead, but now ch->desc is invalid, and it tries to call ch->desc->pagecolor, causing a crash. This is hard to see, of course, since your character was just disconnected due to a buffer overflow, heh.
Dunno if this has been resolved in the current edition, but I was faithfully able to recreate and came up with a solution for my own code: if ( !ch->desc ) return;
ln = colorcode(colstr, colbuf, ch);
You can probably check for d alone there, but that seemed to clear up the crashing issue. Hope that helps someone. If this has been resolved, just lemme know, maybe its time I updated my color code, heh. |