aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-10-05 20:20:07 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-10-05 20:20:07 +0000
commit11cf5afc795f8c10e9ec4e6e4645096df431e498 (patch)
treeb054b80e5999f4baaf915a0bf689b2f8aa95fe9e /res
parent9175ef2365b74951c78f7f49ebf61bd551033094 (diff)
Fix a crash by ensuring that we don't alter memory after it's freed.
(closes issue #17387) Reported by: jmls Patches: 20100726__issue17387.diff.txt uploaded by tilghman (license 14) Tested by: jmls git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@290392 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/res_jabber.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/res/res_jabber.c b/res/res_jabber.c
index a71aec110..621c4ed69 100644
--- a/res/res_jabber.c
+++ b/res/res_jabber.c
@@ -1855,16 +1855,19 @@ static int aji_get_roster(struct aji_client *client)
static int aji_client_connect(void *data, ikspak *pak)
{
struct aji_client *client = ASTOBJ_REF((struct aji_client *) data);
- int res = 0;
+ int res = IKS_FILTER_PASS;
if (client) {
if (client->state == AJI_DISCONNECTED) {
iks_filter_add_rule(client->f, aji_filter_roster, client, IKS_RULE_TYPE, IKS_PAK_IQ, IKS_RULE_SUBTYPE, IKS_TYPE_RESULT, IKS_RULE_ID, "roster", IKS_RULE_DONE);
client->state = AJI_CONNECTING;
client->jid = (iks_find_cdata(pak->query, "jid")) ? iks_id_new(client->stack, iks_find_cdata(pak->query, "jid")) : client->jid;
- iks_filter_remove_hook(client->f, aji_client_connect);
- if(!client->component) /*client*/
+ if (!client->component) { /*client*/
aji_get_roster(client);
+ }
+ iks_filter_remove_hook(client->f, aji_client_connect);
+ /* Once we remove the hook for this routine, we must return EAT or we will crash or corrupt memory */
+ res = IKS_FILTER_EAT;
}
} else
ast_log(LOG_ERROR, "Out of memory.\n");