Changeset 9bcbe48


Ignore:
Timestamp:
2006-11-23T09:34:18Z (17 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
25984f2
Parents:
16b5f86
Message:

Fixed some (possible) NULL-pointer dereferences. THANKS FOR NOTHING to
GLib for giving this very useful "s2 != NULL assertion failed" message
instead of just dereferencing the damn pointer so I can find a backtrace,
this sure makes debugging very easy, guys! Wasn't GLib supposed to SAVE
time?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/iq.c

    r16b5f86 r9bcbe48  
    5151                    strncmp( s, JABBER_CACHED_ID, strlen( JABBER_CACHED_ID ) ) != 0 )
    5252                {
    53                         /* Silently ignore it, without an ID (or an non-cache
     53                        /* Silently ignore it, without an ID (or a non-cache
    5454                           ID) we don't know how to handle the packet and we
    5555                           probably don't have to. */
     
    6060               
    6161                if( entry == NULL )
    62                         serv_got_crap( gc, "WARNING: Received IQ %s packet with unknown/expired ID %s!", type, s );
     62                        serv_got_crap( gc, "WARNING: Received IQ-%s packet with unknown/expired ID %s!", type, s );
    6363                else if( entry->func )
    6464                        return entry->func( gc, node, entry->node );
     
    136136                }
    137137               
     138                /* This is a roster push. XMPP servers send this when someone
     139                   was added to (or removed from) the buddy list. AFAIK they're
     140                   sent even if we added this buddy in our own session. */
    138141                if( strcmp( s, XMLNS_ROSTER ) == 0 )
    139142                {
     
    151154                        else
    152155                        {
    153                                 serv_got_crap( gc, "WARNING: %s tried to fake a roster push!", s );
     156                                serv_got_crap( gc, "WARNING: %s tried to fake a roster push!", s ? s : "(unknown)" );
    154157                               
    155158                                xt_free_node( reply );
     
    214217        char *s;
    215218       
    216         query = xt_find_node( node->children, "query" );
     219        if( !( query = xt_find_node( node->children, "query" ) ) )
     220        {
     221                serv_got_crap( gc, "WARNING: Received incomplete IQ packet while authenticating" );
     222                signoff( gc );
     223                return XT_HANDLED;
     224        }
    217225       
    218226        /* Time to authenticate ourselves! */
     
    264272static xt_status jabber_finish_iq_auth( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig )
    265273{
    266         char *type = xt_find_attr( node, "type" );
    267274        struct jabber_data *jd = gc->proto_data;
     275        char *type;
     276       
     277        if( !( type = xt_find_attr( node, "type" ) ) )
     278        {
     279                serv_got_crap( gc, "WARNING: Received incomplete IQ packet while authenticating" );
     280                signoff( gc );
     281                return XT_HANDLED;
     282        }
    268283       
    269284        if( strcmp( type, "error" ) == 0 )
     
    336351        int initial = ( orig != NULL );
    337352       
    338         query = xt_find_node( node->children, "query" );
     353        if( !( query = xt_find_node( node->children, "query" ) ) )
     354        {
     355                serv_got_crap( gc, "WARNING: Received NULL roster packet" );
     356                return XT_HANDLED;
     357        }
    339358       
    340359        c = query->children;
     
    361380                                if( find_buddy( gc, jid ) == NULL )
    362381                                        add_buddy( gc, NULL, jid, name );
    363                                 else
     382                                else if( name )
    364383                                        serv_buddy_rename( gc, jid, name );
    365384                        }
Note: See TracChangeset for help on using the changeset viewer.