[xmppd-dev] commit r1534 - in trunk/jabberd14: . jabberd
mail at jabberd.org
mail at jabberd.org
Mon Sep 8 14:49:07 CEST 2008
Author: mawis
Date: Mon Sep 8 14:49:07 2008
New Revision: 1534
Log:
There as a fixed buffer of 9 bytes for printing IDs (which are integers). This buffer might be to small. Replaced fixed size buffer with variable size std::ostringstream.
Problem reported by Vince Negri
Modified:
trunk/jabberd14/ChangeLog
trunk/jabberd14/jabberd/xdb.cc
Modified: trunk/jabberd14/ChangeLog
==============================================================================
--- trunk/jabberd14/ChangeLog Mon Sep 8 11:30:29 2008 (r1533)
+++ trunk/jabberd14/ChangeLog Mon Sep 8 14:49:07 2008 (r1534)
@@ -3,6 +3,8 @@
* jsm/modules/mod_roster.cc: fix duplicate roster item problem
* jabberd/lib/jabberdlib.h: better handling of new session control
* jabberd/deliver.cc: same
+ * jabberd/xdb.cc: fix problem with fixed puffer for printing integer
+ (problem reported by Vince Negri)
2008-09-07 Matthias Wimmer <m at tthias.eu>
Modified: trunk/jabberd14/jabberd/xdb.cc
==============================================================================
--- trunk/jabberd14/jabberd/xdb.cc Mon Sep 8 11:30:29 2008 (r1533)
+++ trunk/jabberd14/jabberd/xdb.cc Mon Sep 8 14:49:07 2008 (r1534)
@@ -104,7 +104,7 @@
*/
static void xdb_deliver(instance i, xdbcache xc) {
xmlnode x;
- char ids[9];
+ std::ostringstream ids;
x = xmlnode_new_tag_ns("xdb", NULL, NS_SERVER);
xmlnode_put_attrib_ns(x, "type", NULL, NULL, "get");
@@ -126,8 +126,8 @@
xmlnode_put_attrib_ns(x, "to", NULL, NULL, jid_full(xc->owner));
xmlnode_put_attrib_ns(x, "from", NULL, NULL, i->id);
xmlnode_put_attrib_ns(x, "ns", NULL, NULL, xc->ns);
- snprintf(ids, sizeof(ids), "%d", xc->id);
- xmlnode_put_attrib_ns(x, "id", NULL, NULL, ids); /* to track response */
+ ids << xc->id;
+ xmlnode_put_attrib_ns(x, "id", NULL, NULL, ids.str().c_str()); /* to track response */
log_debug2(ZONE, LOGT_EXECFLOW, "delivering xdb request: %s", xmlnode_serialize_string(x, xmppd::ns_decl_list(), 0));
deliver(dpacket_new(x), i);
}
More information about the dev
mailing list