From bb028b1c7e40b270003e480ea57c90641945e76e Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 20 May 2010 17:54:51 +0000 Subject: [PATCH] * In a rare eureka-moment, discovered that my XML string escape function was only sanitizing characters higher than 0x7F, but the problem character in my data set was 0x01. Fixed. --- citadel/modules/xmpp/serv_xmpp.c | 9 +++++++-- citadel/modules/xmpp/xmpp_presence.c | 8 ++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/citadel/modules/xmpp/serv_xmpp.c b/citadel/modules/xmpp/serv_xmpp.c index d9271e464..31656c18b 100644 --- a/citadel/modules/xmpp/serv_xmpp.c +++ b/citadel/modules/xmpp/serv_xmpp.c @@ -95,11 +95,16 @@ char *xmlesc(char *buf, char *str, int bufsiz) strcpy(&buf[len], "&"); len += 5; } - else if (ch <= 0x7F) { + else if ((ch >= 0x20) && (ch <= 0x7F)) { buf[len++] = ch; buf[len] = 0; } - else if (ch > 0x7F) { + else if (ch < 0x20) { + /* we probably shouldn't be doing this */ + buf[len++] = '_'; + buf[len] = 0; + } + else { char oct[10]; sprintf(oct, "&#%o;", ch); strcpy(&buf[len], oct); diff --git a/citadel/modules/xmpp/xmpp_presence.c b/citadel/modules/xmpp/xmpp_presence.c index e1621a904..2866daa97 100644 --- a/citadel/modules/xmpp/xmpp_presence.c +++ b/citadel/modules/xmpp/xmpp_presence.c @@ -303,6 +303,14 @@ void xmpp_store_mortuary(HashList *mortuary) { } DeleteHashPos(&HashPos); + /* FIXME temp crap + StrBufAppendPrintf(themsg, "foo@bar.com\n"); + StrBufAppendPrintf(themsg, "baz@quux.com\n"); + StrBufAppendPrintf(themsg, "haha%c\n", 1); + StrBufAppendPrintf(themsg, "baaaz@quux.com\n"); + StrBufAppendPrintf(themsg, "baaaz@quuuuuux.com\n"); + */ + /* Delete the old mortuary */ CtdlDeleteMessages(USERCONFIGROOM, NULL, 0, XMPPMORTUARY); -- 2.30.2