From: Art Cancro Date: Thu, 20 May 2010 17:54:51 +0000 (+0000) Subject: * In a rare eureka-moment, discovered that my XML string escape function was only... X-Git-Tag: v7.86~200 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=bb028b1c7e40b270003e480ea57c90641945e76e * 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. --- 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);