[Pidgin] #5695: purple_blist_add_group segfaults if purplebuddylist not set

Pidgin trac at pidgin.im
Thu May 1 23:06:23 EDT 2008


#5695: purple_blist_add_group segfaults if purplebuddylist not set
--------------------------+-------------------------------------------------
Reporter:  BigBrownChunx  |       Owner:  lschiere    
    Type:  defect         |      Status:  new         
Priority:  minor          |   Component:  unclassified
 Version:  2.4.1          |    Keywords:              
 Pending:  0              |  
--------------------------+-------------------------------------------------
 purple_blist_add_group in /libpurple/blist.c will segfault if the
 purplebuddylist has not been set yet, due to the line

 {{{
 if (!purplebuddylist->root)
 }}}

 This same problem is in purple_blist_remove_group, blist_to_xmlnode,
 parse_group, purple_blist_add_chat, purple_blist_add_buddy,
 purple_blist_add_contact.  Some functions in blist.c (purple_find_buddy,
 purple_find_buddies) already check that purplebuddylist != NULL, but not
 all.

 These functions just need
 {{{
 g_return_val_if_fail(purplebuddylist != NULL, NULL);
 }}}
 to fix.
 Either that or using the purple_blist_get_root() function instead of the
 direct purplebuddylist->root call.

 For some reason this was causing crashes in Adium if the protocols had
 started and had data to process before the purplebuddylist had been set.

-- 
Ticket URL: <http://developer.pidgin.im/ticket/5695>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list