summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp')
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
index bc4e8e4..0fd40bf 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
@@ -1,3 +1,3 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
@@ -140,3 +140,10 @@ void SOCKS5BytestreamServerSession::process() {
append(result, createByteArray("\x00\x03", 2));
- result.push_back(boost::numeric_cast<unsigned char>(requestID.size()));
+ try {
+ result.push_back(boost::numeric_cast<unsigned char>(requestID.size()));
+ }
+ catch (const boost::numeric::bad_numeric_cast& e) {
+ SWIFT_LOG(warning) << "SOCKS5 request ID is too long (" << requestID.size() << "): " << e.what() << std::endl;
+ finish();
+ return;
+ }
append(result, concat(requestID, createByteArray("\x00\x00", 2)));