[Pidgin] #15327: CAP plugin crash FIX

Pidgin trac at pidgin.im
Fri Sep 21 16:26:30 EDT 2012


#15327: CAP plugin crash FIX
-------------------------------------------------+-------------------------
 Reporter:  Euro                                 |       Owner:  rekkanoryo
     Type:  patch                                |      Status:  new
Milestone:                                       |   Component:  plugins
  Version:  2.10.6                               |  Resolution:
 Keywords:  crash cap plugin segfault skype      |
  tooltip                                        |
-------------------------------------------------+-------------------------
Description changed by Euro:

Old description:

> I have found a way to reproduce the a crash:
>
> 1. enabled the cap plugin
> 2. connect to skype account via the pidgin-skype plugin
> 3. have a not-authorized contact in your list "(To pending)"
> 4. hover this user in pidgin
> 5. BANG SEGFAULT!
>
> So it has to do with tooltip callback in the plugin:
>
> {{{
> static void drawing_tooltip(PurpleBlistNode *node, GString *text,
> gboolean full);
> }}}
>
> The last log messages shown were:
>
> {{{
> (17:05:36) g_log: purple_status_get_name: assertion `status != NULL'
> failed
> (17:05:36) g_log: purple_status_get_id: assertion `status != NULL' failed
> (17:05:36) g_log: purple_status_get_id: assertion `status != NULL' failed
> }}}
> (in this cases these functions return NULL)
>
> So i searched the plugin code for calls to ''purple_status_get_id'' and
> found this line:
>
> cap.c line 97
> {{{
> if(strcmp(purple_status_get_id(get_status_for(buddy)), "offline") == 0) {
> }}}
>
> So if ''get_status_for(buddy)'' returns NULL (because of a non-authorized
> Buddy [ano: it should return invisible, but the skype plugin seems to
> have a bug here]) it leads to:
>
> {{{
> strcmp(NULL, "offl...
> }}}
> , what causes the SEGFAULT.
>
> Fix for line 97:
> {{{
> char *status = purple_status_get_id(get_status_for(buddy));
> // btw. gchar *status_id is already defined above in the function, i dont
> know why it is not used here
> if(status != NULL && strcmp(status, "offline") == 0) {
> }}}
>
> I dont now where and how to send a patch, sorry.
>
> PS: Sorry for my english-skills :D

New description:

 I have found a way to reproduce the a crash:

 1. enabled the cap plugin
 2. connect to skype account via the pidgin-skype plugin
 3. have a not-authorized contact in your list "(To pending)"
 4. hover this user in pidgin
 5. BANG SEGFAULT!

 So it has to do with tooltip callback in the plugin:

 {{{
 static void drawing_tooltip(PurpleBlistNode *node, GString *text, gboolean
 full);
 }}}

 The last log messages shown were:

 {{{
 (17:05:36) g_log: purple_status_get_name: assertion `status != NULL'
 failed
 (17:05:36) g_log: purple_status_get_id: assertion `status != NULL' failed
 (17:05:36) g_log: purple_status_get_id: assertion `status != NULL' failed
 }}}
 (in this cases these functions return NULL)

 So i searched the plugin code for calls to ''purple_status_get_id'' and
 found this line:

 cap.c line 97
 {{{
 if(strcmp(purple_status_get_id(get_status_for(buddy)), "offline") == 0) {
 }}}

 So if ''get_status_for(buddy)'' returns NULL (because of a non-authorized
 Buddy [ano: it should return invisible, but the skype plugin seems to have
 a bug here]) it leads to:

 {{{
 strcmp(NULL, "offl...
 }}}
 , what causes the SEGFAULT.

 Fix for line 97:
 {{{
 char *status = purple_status_get_id(get_status_for(buddy));
 // btw. gchar *status_id is already defined above in the function, i dont
 know why it is not used here
 if(status != NULL && strcmp(status, "offline") == 0) {
 }}}


 PS: Sorry for my english-skills :D

--

-- 
Ticket URL: <https://developer.pidgin.im/ticket/15327#comment:2>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list