From a26af5c3cf58a5f896ee5af2061115e07a8eeb87 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Tue, 13 Jul 2010 21:13:46 +0100 Subject: Fixing NULL pointer dereferences in Twitter module. Based on patch from wahjava (bug #650). --- protocols/twitter/twitter_lib.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'protocols/twitter/twitter_lib.c') diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index d1b65c26..05607164 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -65,6 +65,8 @@ static void twitter_groupchat_init(struct im_connection *ic); */ static void txu_free(struct twitter_xml_user *txu) { + if (txu == NULL) + return; g_free(txu->name); g_free(txu->screen_name); g_free(txu); @@ -88,6 +90,8 @@ static void txs_free(struct twitter_xml_status *txs) static void txl_free(struct twitter_xml_list *txl) { GSList *l; + if (txl == NULL) + return; for ( l = txl->list; l ; l = g_slist_next(l) ) if (txl->type == TXL_STATUS) txs_free((struct twitter_xml_status *)l->data); @@ -472,6 +476,9 @@ static void twitter_groupchat(struct im_connection *ic, GSList *list) for ( l = list; l ; l = g_slist_next(l) ) { status = l->data; + if (status->user == NULL || status->text == NULL) + continue; + twitter_add_buddy(ic, status->user->screen_name, status->user->name); strip_html(status->text); @@ -735,4 +742,4 @@ void twitter_friendships_create_destroy(struct im_connection *ic, char *who, int args[0] = "screen_name"; args[1] = who; twitter_http(ic, create ? TWITTER_FRIENDSHIPS_CREATE_URL : TWITTER_FRIENDSHIPS_DESTROY_URL, twitter_http_post, ic, 1, args, 2); -} \ No newline at end of file +} -- cgit v1.2.3 From e4e0b3764761c8e204bfdf169d83af950d9e6340 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 15 Jul 2010 23:16:42 +0100 Subject: Fix compatibility with older GLib versions again. (Bug #643, patch from Robert Scheck.) --- protocols/twitter/twitter_lib.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'protocols/twitter/twitter_lib.c') diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index 05607164..0578c5e0 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -35,6 +35,14 @@ #include #include +/* GLib < 2.12.0 doesn't have g_ascii_strtoll(), work around using system strtoll(). */ +/* GLib < 2.12.4 can be buggy: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=488013 */ +#if !GLIB_CHECK_VERSION(2,12,5) +#include +#include +#define g_ascii_strtoll strtoll +#endif + #define TXL_STATUS 1 #define TXL_USER 2 #define TXL_ID 3 -- cgit v1.2.3