[asterisk-commits] phsultan: branch 1.4 r84890 - /branches/1.4/res/res_jabber.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun Oct 7 10:52:45 CDT 2007
Author: phsultan
Date: Sun Oct 7 10:52:44 2007
New Revision: 84890
URL: http://svn.digium.com/view/asterisk?view=rev&rev=84890
Log:
Prevent Asterisk from crashing when receiving a presence packet
without resource from a buddy that is known to have a resource list.
Revert a change I previously made, where Asterisk could point to a
freed memory location.
Modified:
branches/1.4/res/res_jabber.c
Modified: branches/1.4/res/res_jabber.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/res/res_jabber.c?view=diff&rev=84890&r1=84889&r2=84890
==============================================================================
--- branches/1.4/res/res_jabber.c (original)
+++ branches/1.4/res/res_jabber.c Sun Oct 7 10:52:44 2007
@@ -1185,7 +1185,7 @@
tmp = buddy->resources;
descrip = ast_strdup(iks_find_cdata(pak->x,"status"));
- while (tmp) {
+ while (tmp && pak->from->resource) {
if (!strcasecmp(tmp->resource, pak->from->resource)) {
tmp->status = status;
if (tmp->description) free(tmp->description);
@@ -1258,7 +1258,7 @@
}
/* resource not found in our list, create it */
- if (!found && status != 6) {
+ if (!found && status != 6 && pak->from->resource) {
found = (struct aji_resource *) malloc(sizeof(struct aji_resource));
memset(found, 0, sizeof(struct aji_resource));
@@ -1293,12 +1293,6 @@
buddy->resources = found;
}
- /* if 'from' attribute does not contain 'resource' string
- point to the top of our resource list */
- if (!found && !pak->from->resource && buddy->resources) {
- found = buddy->resources;
- }
-
ASTOBJ_UNLOCK(buddy);
ASTOBJ_UNREF(buddy, aji_buddy_destroy);
@@ -1311,7 +1305,8 @@
ver = iks_find_attrib(iks_find(pak->x, "caps:c"), "ver");
}
- if(status !=6 && !found->cap) {
+ /* retrieve capabilites of the new resource */
+ if(status !=6 && found && !found->cap) {
found->cap = aji_find_version(node, ver, pak);
if(gtalk_yuck(pak->x)) /* gtalk should do discover */
found->cap->jingle = 1;
More information about the asterisk-commits
mailing list