diff options
Diffstat (limited to 'src')
-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) { |