From 4fff701800cfb3f5a27d7889561dceba18e29239 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 22 Apr 2005 21:16:09 +0000 Subject: 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 --- src/commands.cpp | 7 ++++++- src/connection.cpp | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) 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 &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) { -- cgit v1.2.3