summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/socket.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/socket.cpp b/src/socket.cpp
index da179d9c8..282d3c5a7 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -29,6 +29,7 @@ using namespace std;
#include <sstream>
#include <iostream>
#include <fstream>
+#include <stdexcept>
#include "socket.h"
#include "inspircd.h"
#include "inspircd_io.h"
@@ -241,7 +242,16 @@ char* InspSocket::Read()
// and should be aborted.
int InspSocket::Write(std::string data)
{
- this->Buffer.append(data);
+ try
+ {
+ if ((data != "") && (this->Buffer.length() + data.length() < this->Buffer.max_size()))
+ this->Buffer.append(data);
+ }
+ catch (std::length_error)
+ {
+ log(DEBUG,"std::length_error exception caught while appending to socket buffer!");
+ return 0;
+ }
return data.length();
}