diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commands.cpp | 12 | ||||
-rw-r--r-- | src/inspircd.cpp | 6 | ||||
-rw-r--r-- | src/servers.cpp | 2 | ||||
-rw-r--r-- | src/users.cpp | 6 |
4 files changed, 14 insertions, 12 deletions
diff --git a/src/commands.cpp b/src/commands.cpp index ae4b97c3e..5ab25e4f0 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1164,7 +1164,7 @@ void handle_user(char **parameters, int pcnt, userrec *user) else { strcpy(user->ident,"~"); /* we arent checking ident... but these days why bother anyway? */ strlcat(user->ident,parameters[0],IDENTMAX); - strlcpy(user->fullname,parameters[3],128); + strlcpy(user->fullname,parameters[3],MAXGECOS); user->registered = (user->registered | 1); } } @@ -1228,12 +1228,12 @@ void handle_away(char **parameters, int pcnt, userrec *user) { if (pcnt) { - strlcpy(user->awaymsg,parameters[0],512); + strlcpy(user->awaymsg,parameters[0],MAXAWAY); WriteServ(user->fd,"306 %s :You have been marked as being away",user->nick); } else { - strlcpy(user->awaymsg,"",512); + strlcpy(user->awaymsg,"",MAXAWAY); WriteServ(user->fd,"305 %s :You are no longer marked as being away",user->nick); } } @@ -2407,8 +2407,8 @@ void handle_N(char token,char* params,serverrec* source,serverrec* reply, char* strlcpy(clientlist[nick]->host, host,160); strlcpy(clientlist[nick]->dhost, dhost,160); strlcpy(clientlist[nick]->server, server,256); - strlcpy(clientlist[nick]->ident, ident,10); // +1 char to compensate for tilde - strlcpy(clientlist[nick]->fullname, gecos,128); + strlcpy(clientlist[nick]->ident, ident,IDENTMAX); // +1 char to compensate for tilde + strlcpy(clientlist[nick]->fullname, gecos,MAXGECOS); strlcpy(clientlist[nick]->ip,ipaddr,16); clientlist[nick]->signon = TS; clientlist[nick]->nping = 0; // this is ignored for a remote user anyway. @@ -2448,7 +2448,7 @@ void handle_a(char token,char* params,serverrec* source,serverrec* reply, char* userrec* user = Find(nick); if (user) - strlcpy(user->fullname,gecos,MAXBUF); + strlcpy(user->fullname,gecos,MAXGECOS); } void handle_b(char token,char* params,serverrec* source,serverrec* reply, char* tcp_host, char* tcp_sum) diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 43142f893..47f699a91 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -1310,10 +1310,10 @@ void AddWhoWas(userrec* u) whowas_hash::iterator iter = whowas.find(u->nick); WhoWasUser *a = new WhoWasUser(); strlcpy(a->nick,u->nick,NICKMAX); - strlcpy(a->ident,u->ident,15); + strlcpy(a->ident,u->ident,IDENTMAX); strlcpy(a->dhost,u->dhost,160); strlcpy(a->host,u->host,160); - strlcpy(a->fullname,u->fullname,128); + strlcpy(a->fullname,u->fullname,MAXGECOS); strlcpy(a->server,u->server,256); a->signon = u->signon; @@ -1401,7 +1401,7 @@ void AddClient(int socket, char* host, int port, bool iscached, char* ip) strncpy(clientlist[tempnick]->host, host,160); strncpy(clientlist[tempnick]->dhost, host,160); strncpy(clientlist[tempnick]->server, ServerName,256); - strncpy(clientlist[tempnick]->ident, "unknown",15); + strncpy(clientlist[tempnick]->ident, "unknown",IDENTMAX); clientlist[tempnick]->registered = 0; clientlist[tempnick]->signon = TIME+dns_timeout; clientlist[tempnick]->lastping = 1; diff --git a/src/servers.cpp b/src/servers.cpp index cf5d30f01..891eaf722 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -326,7 +326,7 @@ void serverrec::FlushWriteBuffers() } has_been_netsplit = true; } - if (this->connectors[i].HasBufferedOutput()) + if ((this->connectors[i].HasBufferedOutput()) && (this->connectors[i].GetState() != STATE_DISCONNECTED)) { if (!this->connectors[i].FlushWriteBuf()) { diff --git a/src/users.cpp b/src/users.cpp index 8c7f1409b..cf977dff2 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -67,6 +67,7 @@ void userrec::CloseSocket() char* userrec::GetFullHost() { + static char result[MAXBUF]; snprintf(result,MAXBUF,"%s!%s@%s",nick,ident,dhost); return result; } @@ -83,8 +84,9 @@ int userrec::ReadData(void* buffer, size_t size) char* userrec::GetFullRealHost() { - snprintf(result,MAXBUF,"%s!%s@%s",nick,ident,host); - return result; + static char fresult[MAXBUF]; + snprintf(fresult,MAXBUF,"%s!%s@%s",nick,ident,host); + return fresult; } bool userrec::IsInvited(char* channel) |