[xmppd-dev] commit r1548 - branches/RELEASE-1_6_1/jabberd

mail at jabberd.org mail at jabberd.org
Mon Dec 8 20:23:58 CET 2008


Author: mawis
Date: Mon Dec  8 20:23:58 2008
New Revision: 1548

Log:
Sending NULL byte after the flash policy document

Modified:
   branches/RELEASE-1_6_1/jabberd/mio_xml.cc

Modified: branches/RELEASE-1_6_1/jabberd/mio_xml.cc
==============================================================================
--- branches/RELEASE-1_6_1/jabberd/mio_xml.cc	Mon Dec  8 19:12:11 2008	(r1547)
+++ branches/RELEASE-1_6_1/jabberd/mio_xml.cc	Mon Dec  8 20:23:58 2008	(r1548)
@@ -464,8 +464,8 @@
 
 
 			if (file_size < 1024*1024) {
-			    char *result_buffer = new char[file_size];
-			    file.read(result_buffer, file_size);
+			    char *result_buffer = new char[static_cast<int>(file_size)+1];
+			    result_buffer[file_size] = 0; // append NULL byte
 			    mio_write(m, NULL, result_buffer, file_size);
 			    delete[] result_buffer;
 
@@ -481,8 +481,10 @@
 	    }
 
 	    // no configured flash policy, or policy too big. Send default
+	    std::string default_policy("<?xml version='1.0'?>\n<!DOCTYPE cross-domain-policy SYSTEM \"/xml/dtds/cross-domain-policy.dtd\">\n<cross-domain-policy/>\n");
 	    log_notice(NULL, "Received Flash policy-file-request, but none is configured. Returning (empty) default policy.");
-	    mio_write(m, NULL, "<?xml version='1.0'?>\n<!DOCTYPE cross-domain-policy SYSTEM \"/xml/dtds/cross-domain-policy.dtd\">\n<cross-domain-policy/>\n", -1);
+	    mio_write(m, NULL, default_policy.c_str(), default_policy.length()+1); // length()+1 because we want to send the NULL byte as well
+	    mio_write(m, NULL, "\0", 1);
 	    mio_close(m);
 	    return;
 


More information about the dev mailing list