diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-09-11 20:10:05 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-09-11 20:10:05 +0000 |
commit | e7f0a0fb7edf96abbddf72eadb490b5eb22447ec (patch) | |
tree | 67c9bfeadf64d1622e8ed060a55969ddb6452834 /src/connection.cpp | |
parent | ea36f2bb1b8b1bf03b8615672866f93697caff75 (diff) |
Security audit based on RATS output
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@855 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/connection.cpp')
-rw-r--r-- | src/connection.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/connection.cpp b/src/connection.cpp index 97619619f..d60da90ac 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -202,7 +202,7 @@ bool connection::BeginLink(char* targethost, int port, char* password, char* ser // targethost has been turned into an ip... // we dont want this as the server name. connector.SetServerName(servername); - sprintf(connect,"S %s %s %d %d :%s",getservername().c_str(),password,myport,GetRevision(),getserverdesc().c_str()); + snprintf(connect,MAXBUF,"S %s %s %d %d :%s",getservername().c_str(),password,myport,GetRevision(),getserverdesc().c_str()); connector.SetState(STATE_NOAUTH_OUTBOUND); connector.SetHostAndPort(targethost, port); this->connectors.push_back(connector); @@ -232,7 +232,7 @@ bool connection::MeshCookie(char* targethost, int port, long cookie, char* serve // targethost has been turned into an ip... // we dont want this as the server name. connector.SetServerName(servername); - sprintf(connect,"- %d %s :%s",cookie,getservername().c_str(),getserverdesc().c_str()); + snprintf(connect,MAXBUF,"- %d %s :%s",cookie,getservername().c_str(),getserverdesc().c_str()); connector.SetState(STATE_NOAUTH_OUTBOUND); connector.SetHostAndPort(targethost, port); connector.SetState(STATE_CONNECTED); @@ -357,7 +357,7 @@ bool connection::SendPacket(char *message, const char* host) if (!strchr(message,'\n')) { - strncat(message,"\n",MAXBUF); + strlcat(message,"\n",MAXBUF); } if (cn) @@ -368,7 +368,7 @@ bool connection::SendPacket(char *message, const char* host) { log(DEBUG,"Main route to %s is down, seeking alternative",host); // fix: can only route one hop to avoid a loop - if (strncat(message,"R ",2)) + if (strlcat(message,"R ",2)) { // this route is down, we must re-route the packet through an available point in the mesh. for (int k = 0; k < this->connectors.size(); k++) @@ -452,7 +452,7 @@ bool connection::RecvPacket(std::deque<std::string> &messages, char* host) if (strlen(sanitized)) { messages.push_back(sanitized); - strncpy(host,this->connectors[i].GetServerName().c_str(),160); + strlcpy(host,this->connectors[i].GetServerName().c_str(),160); log(DEBUG,"main: Connection::RecvPacket() got '%s' from %s",sanitized,host); } |