X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsocket.cpp;h=282d3c5a72fb4355bdfe74e347a28e6d0fb45080;hb=59b1a8955142935b02af6446005ab47fc7c3fc8c;hp=da179d9c8cc12d1905ad9747a22a7cf66efb543f;hpb=e9b85e303c7e978161d189db6ac459f7d9fa14ca;p=user%2Fhenk%2Fcode%2Finspircd.git 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 #include #include +#include #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(); }