diff options
Diffstat (limited to 'ircxmpp.c')
-rw-r--r-- | ircxmpp.c | 26 |
1 files changed, 14 insertions, 12 deletions
@@ -138,18 +138,20 @@ static void bridge_forward (const char * f, const char * m, struct ircxmpp * irc bridge->side = !s; tsearch(bridge, &ircxmpp->bridges, bridge_compare); if (s == IRC) { - char buf[512+512+strlen(ircxmpp->domain)]; // for good measure, i think - char * cp = strchr(f, '@'); // 512+1+strlen is enough - if (cp) { // cmiiw - strncpy(buf, cp+1, 511); - buf[511] = '\0'; - } else - strcpy(buf, "unable.to.extract.domain.from.JID"); - *strchrnul(buf, '/') = '\0'; - if (buf[strlen(buf)-1] != '.') // jid domain can probably end with a dot. - strcat(buf, "."); // two consecutive dots would invalidate - strcat(buf, ircxmpp->domain); // the domain - ircxmpp->domain_setter(ircxmpp->domain_setter_userdata, buf); + if (ircxmpp->domain) { + char buf[512+512+strlen(ircxmpp->domain)]; // for good measure + char * cp = strchr(f, '@'); // 512+1+strlen is ok + if (cp) { // cmiiw + strncpy(buf, cp+1, 511); + buf[511] = '\0'; + } else + strcpy(buf, "unable.to.extract.domain.from.JID"); + *strchrnul(buf, '/') = '\0'; + if (buf[strlen(buf)-1] != '.') // jid domain can probably end with . + strcat(buf, "."); // two consecutive dots would + strcat(buf, ircxmpp->domain); // +invalidate the domain + ircxmpp->domain_setter(ircxmpp->domain_setter_userdata, buf); + } init_irc(bridge); } else { bridge->conn = xmpp_conn_new(bridge->ircxmpp->ctx); |