diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-02-16 18:39:25 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-02-16 18:39:25 +0000 |
commit | bba10a7af4df8f943152607ded0c3d45460b1d73 (patch) | |
tree | 4d304969be07c9acb3639ac2615a57a91d2ca66d /src | |
parent | e9b85e303c7e978161d189db6ac459f7d9fa14ca (diff) |
Extra checking and exception handling in InspSocket::Write
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3228 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/socket.cpp | 12 |
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(); } |