diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-22 21:16:09 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-22 21:16:09 +0000 |
commit | 4fff701800cfb3f5a27d7889561dceba18e29239 (patch) | |
tree | b7577b5d100b86987be7fe25280ba78c07603969 | |
parent | 20bf4e0a20cb42f02f361bd955dad9516b4201b9 (diff) |
Fixed weird issues when anope sends large amounts of text at once to the uplink
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1164 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/commands.cpp | 7 | ||||
-rw-r--r-- | src/connection.cpp | 15 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/commands.cpp b/src/commands.cpp index db2cd3624..98a5809f6 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -2825,9 +2825,15 @@ void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv) } char response[10240]; + char old2[MAXBUF]; char token = udp_msg[0]; char* old = udp_msg; + if ((token != ':') && (strlen(udp_msg)>1) && (udp_msg[1] != ' ')) + { + WriteOpers("*** Discarded %d chars illegal data from %s",strlen(udp_msg),tcp_host); + } + if (token == ':') // leading :servername or details - strip them off (services does this, sucky) { char* src = udp_msg+1; @@ -2937,7 +2943,6 @@ void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv) } - char* params = udp_msg + 2; char finalparam[1024]; strcpy(finalparam," :xxxx"); diff --git a/src/connection.cpp b/src/connection.cpp index b197caef1..f6b2cea96 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -436,6 +436,21 @@ bool connection::RecvPacket(std::deque<std::string> &messages, char* host) } if (rcvsize > 0) { + if ((data[rcvsize-1] != '\r') && (data[rcvsize-1] != '\n')) + { + char foo = ' '; + while ((foo != '\n') && (rcvsize < 32767)) + { + int x = recv(this->connectors[i].GetDescriptor(),(void*)&foo,1,0); + if ((x == -1) && (errno != EAGAIN)) + break; + if ((x) && (rcvsize < 32767)) + { + data[rcvsize] = foo; + data[++rcvsize] = '\0'; + } + } + } char* l = strtok(data,"\n"); while (l) { |