# HG changeset patch # User Daniel Atallah # Date 1163737881 0 # Node ID dc9ed6c44c48deaaf23cd684f1f545499290b119 # Parent 167421cfe7d7621c494356b2d68d3defee445c9a [gaim-migrate @ 17766] This should prevent a crash when reading a malformed custom emoticon. Also add some debuggering output for when this happens to see if we can figure out the exact scenario. committer: Tailor Script diff -r 167421cfe7d7 -r dc9ed6c44c48 libgaim/protocols/msn/object.c --- a/libgaim/protocols/msn/object.c Fri Nov 17 03:29:45 2006 +0000 +++ b/libgaim/protocols/msn/object.c Fri Nov 17 04:31:21 2006 +0000 @@ -22,6 +22,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "object.h" +#include "debug.h" #define GET_STRING_TAG(field, id) \ if ((tag = strstr(str, id "=\"")) != NULL) \ @@ -94,6 +95,7 @@ if (obj->creator == NULL || obj->size == 0 || obj->type == 0 || obj->location == NULL || obj->friendly == NULL || obj->sha1d == NULL || obj->sha1c == NULL) { + gaim_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str); msn_object_destroy(obj); obj = NULL; } @@ -106,23 +108,12 @@ { g_return_if_fail(obj != NULL); - if (obj->creator != NULL) - g_free(obj->creator); - - if (obj->location != NULL) - g_free(obj->location); - - if (obj->real_location != NULL) - g_free(obj->real_location); - - if (obj->friendly != NULL) - g_free(obj->friendly); - - if (obj->sha1d != NULL) - g_free(obj->sha1d); - - if (obj->sha1c != NULL) - g_free(obj->sha1c); + g_free(obj->creator); + g_free(obj->location); + g_free(obj->real_location); + g_free(obj->friendly); + g_free(obj->sha1d); + g_free(obj->sha1c); if (obj->local) local_objs = g_list_remove(local_objs, obj); diff -r 167421cfe7d7 -r dc9ed6c44c48 libgaim/protocols/msn/slp.c --- a/libgaim/protocols/msn/slp.c Fri Nov 17 03:29:45 2006 +0000 +++ b/libgaim/protocols/msn/slp.c Fri Nov 17 04:31:21 2006 +0000 @@ -819,6 +819,9 @@ smile = tokens[tok]; obj = msn_object_new_from_string(gaim_url_decode(tokens[tok + 1])); + if (obj == NULL) + break; + who = msn_object_get_creator(obj); sha1c = msn_object_get_sha1c(obj); diff -r 167421cfe7d7 -r dc9ed6c44c48 libgaim/protocols/msn/slplink.c --- a/libgaim/protocols/msn/slplink.c Fri Nov 17 03:29:45 2006 +0000 +++ b/libgaim/protocols/msn/slplink.c Fri Nov 17 04:31:21 2006 +0000 @@ -147,6 +147,9 @@ { MsnSlpLink *slplink; + g_return_val_if_fail(session != NULL, NULL); + g_return_val_if_fail(username != NULL, NULL); + slplink = msn_session_find_slplink(session, username); if (slplink == NULL)