# HG changeset patch # User Mikael Berthe # Date 1128285096 -7200 # Node ID c024d1d5d3501f63ad933af07103eca6f2e2d19f # Parent 75442262c08255e97fdf878d63107376b953ce65 Fix segfault when receiving a message stanza with no body tag diff -r 75442262c082 -r c024d1d5d350 mcabber/src/jabglue.c --- a/mcabber/src/jabglue.c Sun Oct 02 18:05:34 2005 +0200 +++ b/mcabber/src/jabglue.c Sun Oct 02 22:31:36 2005 +0200 @@ -834,18 +834,21 @@ char *tmp = NULL; time_t timestamp = 0; - x = xmlnode_get_tag(packet->x, "body"); - p = xmlnode_get_data(x); if (p) body = p; + body = xmlnode_get_tag_data(packet->x, "body"); - if ((x = xmlnode_get_tag(packet->x, "subject")) != NULL) - if ((p = xmlnode_get_data(x)) != NULL) { - tmp = g_new(char, strlen(body)+strlen(p)+4); + p = xmlnode_get_tag_data(packet->x, "subject"); + if (p != NULL) { + if (type && !strcmp(type, "groupchat")) { + // That's a room topic + } else { + tmp = g_new(char, (body ? strlen(body) : 0) + strlen(p) + 4); *tmp = '['; strcpy(tmp+1, p); strcat(tmp, "]\n"); - strcat(tmp, body); + if (body) strcat(tmp, body); body = tmp; } + } /* there can be multiple tags. we're looking for one with xmlns = jabber:x:encrypted */