aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-07-13 21:13:46 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2010-07-13 21:13:46 +0100
commita26af5c3cf58a5f896ee5af2061115e07a8eeb87 (patch)
treedd8c3d221a948eb18558c8aec1282c6e0974c523
parent00540d40be63b4db537a661d1a17c49a1790f79c (diff)
Fixing NULL pointer dereferences in Twitter module. Based on patch from
wahjava (bug #650).
-rw-r--r--protocols/twitter/twitter_lib.c9
1 files changed, 8 insertions, 1 deletions
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
+}