[xmppd-dev] commit r1535 - in branches/RELEASE-1_6_1: . jabberd
mail at jabberd.org
mail at jabberd.org
Mon Sep 8 14:51:44 CEST 2008
Author: mawis
Date: Mon Sep 8 14:51:44 2008
New Revision: 1535
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:
branches/RELEASE-1_6_1/ChangeLog
branches/RELEASE-1_6_1/jabberd/xdb.cc
Modified: branches/RELEASE-1_6_1/ChangeLog
==============================================================================
--- branches/RELEASE-1_6_1/ChangeLog Mon Sep 8 14:49:07 2008 (r1534)
+++ branches/RELEASE-1_6_1/ChangeLog Mon Sep 8 14:51:44 2008 (r1535)
@@ -1,3 +1,8 @@
+2008-09-08 Matthias Wimmer <m at tthias.eu>
+
+ * 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>
* bootstrap: update for newer build tools
Modified: branches/RELEASE-1_6_1/jabberd/xdb.cc
==============================================================================
--- branches/RELEASE-1_6_1/jabberd/xdb.cc Mon Sep 8 14:49:07 2008 (r1534)
+++ branches/RELEASE-1_6_1/jabberd/xdb.cc Mon Sep 8 14:51:44 2008 (r1535)
@@ -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