# HG changeset patch # User Tim Ringenbach # Date 1085547310 0 # Node ID f13172eed3adab77b5c8ab73adfbafc4b8bd9db0 # Parent 0c69f518265259049d258073ee2bde8ac10cc42e [gaim-migrate @ 9846] This fixes what is hopefully the last common direct connect segfault. Basicly, we were memcpying cookies, and one was null. This was because our get the cookie function was returning null, because it checked if the conn was a direct im conn and it wasn't. It was a listening conn instead. So this adds NULL checks, and makes the get cookie function do less sanity checking, since it was failing some valid cases. committer: Tailor Script diff -r 0c69f5182652 -r f13172eed3ad src/protocols/oscar/ft.c --- a/src/protocols/oscar/ft.c Wed May 26 03:28:36 2004 +0000 +++ b/src/protocols/oscar/ft.c Wed May 26 04:55:10 2004 +0000 @@ -423,10 +423,6 @@ if (!conn || !conn->internal) return NULL; - if ((conn->type != AIM_CONN_TYPE_RENDEZVOUS) || - (conn->subtype != AIM_CONN_SUBTYPE_OFT_DIRECTIM)) - return NULL; - intdata = (struct aim_odc_intdata *)conn->internal; return intdata->cookie; diff -r 0c69f5182652 -r f13172eed3ad src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Wed May 26 03:28:36 2004 +0000 +++ b/src/protocols/oscar/oscar.c Wed May 26 04:55:10 2004 +0000 @@ -3141,9 +3141,16 @@ } static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { - GaimConnection *gc = sess->aux_data; - OscarData *od = gc->proto_data; - const char *username = gaim_account_get_username(gaim_connection_get_account(gc)); + GaimConnection *gc; + OscarData *od; + const char *username; + + g_return_val_if_fail(sess != NULL, 0); + g_return_val_if_fail(sess->aux_data != NULL, 0); + + gc = sess->aux_data; + od = gc->proto_data; + username = gaim_account_get_username(gaim_connection_get_account(gc)); if (!args) return 0; @@ -3283,7 +3290,9 @@ * and then ask them to connect to us. */ snprintf(d->ip, sizeof(d->ip), "%s:%d", args->clientip, args->port?args->port:5190); memcpy(d->cookie, args->cookie, 8); - if (dim && !dim->connected && (!memcmp(aim_odc_getcookie(dim->conn), args->cookie, 8))) { + if (dim && !dim->connected && aim_odc_getcookie(dim->conn) && args->cookie && + (!memcmp(aim_odc_getcookie(dim->conn), args->cookie, 8))) { + oscar_direct_im_destroy(od, dim); d->donttryagain = TRUE; accept_direct_im_request(d); @@ -3757,7 +3766,7 @@ struct oscar_direct_im *dim; gaim_debug_info("oscar", - "AAA - Other user declined some sort of direct" + "AAA - Other user declined some sort of direct " "connect attempt (automaticly?)\n"); if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, cookie))) gaim_xfer_cancel_remote(xfer);