summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-05-18 16:22:06 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-05-18 16:50:18 (GMT)
commit8472194d716e0e3b95a66bf5be45c246ee79d0af (patch)
treeb9f473e0e606b012ee5013e85d2cf5e7523b7029 /Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
parentb1b3b8f88517ad8b14795cc8a6265962d2935be3 (diff)
downloadswift-contrib-8472194d716e0e3b95a66bf5be45c246ee79d0af.zip
swift-contrib-8472194d716e0e3b95a66bf5be45c246ee79d0af.tar.bz2
Propagate use of SafeByteArray down to the connection.
Diffstat (limited to 'Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp')
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
index fadfd46..477af4b 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
@@ -10,6 +10,7 @@
#include <iostream>
#include <Swiften/Base/ByteArray.h>
+#include <Swiften/Base/SafeByteArray.h>
#include <Swiften/Base/Algorithm.h>
#include <Swiften/Base/Concat.h>
#include <Swiften/FileTransfer/SOCKS5BytestreamRegistry.h>
@@ -36,7 +37,7 @@ void SOCKS5BytestreamServerSession::stop() {
finish(false);
}
-void SOCKS5BytestreamServerSession::handleDataRead(const ByteArray& data) {
+void SOCKS5BytestreamServerSession::handleDataRead(const SafeByteArray& data) {
append(unprocessedData, data);
process();
}
@@ -56,7 +57,7 @@ void SOCKS5BytestreamServerSession::process() {
std::cerr << "SOCKS5BytestreamServerSession: Junk after authentication mechanism";
}
unprocessedData.clear();
- connection->write(createByteArray("\x05\x00", 2));
+ connection->write(createSafeByteArray("\x05\x00", 2));
state = WaitingForRequest;
}
}
@@ -77,7 +78,7 @@ void SOCKS5BytestreamServerSession::process() {
std::cerr << "SOCKS5BytestreamServerSession: Junk after authentication mechanism";
}
bytestream = bytestreams->getBytestream(byteArrayToString(requestID));
- ByteArray result = createByteArray("\x05", 1);
+ SafeByteArray result = createSafeByteArray("\x05", 1);
result.push_back(bytestream ? 0x0 : 0x4);
append(result, createByteArray("\x00\x03", 2));
result.push_back(static_cast<char>(requestID.size()));
@@ -99,7 +100,7 @@ void SOCKS5BytestreamServerSession::process() {
void SOCKS5BytestreamServerSession::sendData() {
if (!bytestream->isFinished()) {
try {
- connection->write(bytestream->read(chunkSize));
+ connection->write(createSafeByteArray(bytestream->read(chunkSize)));
}
catch (const BytestreamException&) {
finish(true);