[Pidgin] #15755: Adium crash as a result of bug in purple_xfer_set_local_filename

Pidgin trac at pidgin.im
Fri Sep 13 17:54:35 EDT 2013


#15755: Adium crash as a result of bug in purple_xfer_set_local_filename
--------------------+-----------------------
 Reporter:  fain    |      Owner:
     Type:  patch   |     Status:  new
Milestone:          |  Component:  libpurple
  Version:  2.10.7  |   Keywords:
--------------------+-----------------------
 purple_xfer_set_local_filename (in libpurple/ft.c) frees the
 "xfer->local_filename" before setting it to the passed-in value. However,
 if the passed-in "filename" is the same pointer as local_filename, the
 string will be nil and the app will crash under libgmalloc (see:
 https://trac.adium.im/ticket/16352#no1 ). The fix is simple: just check if
 the pointer values are equal, and if so, don't free the old string and
 copy the new one.

 basically the new function should look like:

 void
 purple_xfer_set_local_filename(PurpleXfer *xfer, const char *filename)
 {
         g_return_if_fail(xfer != NULL);

         if (filename != xfer->local_filename) {
                 g_free(xfer->local_filename);
                 xfer->local_filename = g_strdup(filename);
         }
 }


 A lot of the functions in this file have this problem, so it might be
 worth running through it.

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


More information about the Tracker mailing list