X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=citadel%2Fmodules%2Fxmpp%2Fxmpp_presence.c;h=a57c124669100438eb53233c52fca77046f3efcf;hp=c2c1af5cfdd9115abb3cff8f71f760bf3c670295;hb=3cf8a1a8e2f9c5aad66f22f9c59b96d2d617a3f3;hpb=6bcccabbc7624b13bb3ae2f857c9873dee8b4c5c diff --git a/citadel/modules/xmpp/xmpp_presence.c b/citadel/modules/xmpp/xmpp_presence.c index c2c1af5cf..a57c12466 100644 --- a/citadel/modules/xmpp/xmpp_presence.c +++ b/citadel/modules/xmpp/xmpp_presence.c @@ -207,6 +207,7 @@ void xmpp_fetch_mortuary_backend(long msgnum, void *userdata) { const char *ptr = NULL; const char *endptr = NULL; int in_body = 0; + int len; char buf[256]; msg = CtdlFetchMessage(msgnum, 1); @@ -218,9 +219,12 @@ void xmpp_fetch_mortuary_backend(long msgnum, void *userdata) { ptr = msg->cm_fields['M']; endptr = ptr + strlen(ptr); // only do strlen once :) - while (ptr = memreadline(ptr, buf, (sizeof buf - 2)), ((ptr < endptr) && (*ptr != 0)) ) { + while (ptr = memreadlinelen(ptr, buf, (sizeof buf - 2), &len), ((ptr < endptr) && (*ptr != 0)) ) { if (in_body) { - Put(mortuary, buf, strlen(buf), buf, generic_free_handler); + char *pch; + pch = malloc(len + 1); + memcpy(pch, buf, len + 1); + Put(mortuary, pch, len, pch, NULL); } if (IsEmptyStr(buf)) in_body = 1; }