From 03a85ddeaf120bd7234089f9f5333d7895f96deb Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 22 Feb 2006 18:36:33 +0000 Subject: Oh yae, Oh Yae, back in old days of yore, Ye Brain doth set the nick buffer as NICKLEN+1 to ease understanding by newbs who didnt know what thou null terminator was. And yae, at a date later hence, Ye Brain then setteth ye buffer back to NICKLEN again. Alas, neither Ye Brain nor Ye trusty followers hath then setteth back the rest of the core to NICKLEN-1, and verily, chaos ensued. :p git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3286 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/channels.cpp | 2 +- src/cmd_oper.cpp | 2 +- src/cmd_topic.cpp | 2 +- src/dnsqueue.cpp | 2 +- src/message.cpp | 2 +- src/mode.cpp | 6 +++--- src/modules/extra/m_sqloper.cpp | 2 +- src/modules/m_spanningtree.cpp | 6 +++--- src/users.cpp | 4 ++-- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/channels.cpp b/src/channels.cpp index 8ca993f2b..fc6c90b5d 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -290,7 +290,7 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri chanlist[cname]->binarymodes = CM_TOPICLOCK | CM_NOEXTERNAL; chanlist[cname]->created = TIME; *chanlist[cname]->topic = 0; - strlcpy(chanlist[cname]->setby, user->nick,NICKMAX); + strlcpy(chanlist[cname]->setby, user->nick,NICKMAX-1); chanlist[cname]->topicset = 0; Ptr = chanlist[cname]; log(DEBUG,"add_channel: created: %s",cname); diff --git a/src/cmd_oper.cpp b/src/cmd_oper.cpp index 15e0df3c4..7cbf4b79f 100644 --- a/src/cmd_oper.cpp +++ b/src/cmd_oper.cpp @@ -117,7 +117,7 @@ void cmd_oper::Handle (char **parameters, int pcnt, userrec *user) log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but oper type erroneous.",user->nick,user->ident,user->host); return; } - strlcpy(user->oper,TypeName,NICKMAX); + strlcpy(user->oper,TypeName,NICKMAX-1); found = true; fail2 = false; break; diff --git a/src/cmd_topic.cpp b/src/cmd_topic.cpp index 96aadd8fd..c1eb50532 100644 --- a/src/cmd_topic.cpp +++ b/src/cmd_topic.cpp @@ -132,7 +132,7 @@ void cmd_topic::Handle (char **parameters, int pcnt, userrec *user) } strlcpy(Ptr->topic,topic,MAXTOPIC); - strlcpy(Ptr->setby,user->nick,NICKMAX); + strlcpy(Ptr->setby,user->nick,NICKMAX-1); Ptr->topicset = TIME; WriteChannel(Ptr,user,"TOPIC %s :%s",Ptr->name, Ptr->topic); if (IS_LOCAL(user)) diff --git a/src/dnsqueue.cpp b/src/dnsqueue.cpp index c117ad4cb..8be3ea99b 100644 --- a/src/dnsqueue.cpp +++ b/src/dnsqueue.cpp @@ -95,7 +95,7 @@ public: { return false; } - strlcpy(u,nick.c_str(),NICKMAX); + strlcpy(u,nick.c_str(),NICKMAX-1); /* ASSOCIATE WITH DNS LOOKUP LIST */ if (resolver1.GetFD() != -1) diff --git a/src/message.cpp b/src/message.cpp index d071b13f0..4f8e25bee 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -425,7 +425,7 @@ void TidyBan(char *ban) pos_of_pling++; pos_of_at++; - strlcpy(NICK,temp,NICKMAX); + strlcpy(NICK,temp,NICKMAX-1); strlcpy(IDENT,pos_of_pling,IDENTMAX+1); strlcpy(HOST,pos_of_at,160); diff --git a/src/mode.cpp b/src/mode.cpp index 02fdd937d..40ef66f0d 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -453,11 +453,11 @@ char* ModeParser::AddBan(userrec *user,char *dest,chanrec *chan,int status) strlcpy(b.data,dest,MAXBUF); if (*user->nick) { - strlcpy(b.set_by,user->nick,NICKMAX); + strlcpy(b.set_by,user->nick,NICKMAX-1); } else { - strlcpy(b.set_by,Config->ServerName,NICKMAX); + strlcpy(b.set_by,Config->ServerName,NICKMAX-1); } chan->bans.push_back(b); return dest; @@ -1215,7 +1215,7 @@ bool ModeParser::ProcessModuleUmode(char umode, userrec* source, void* dest, boo if (!source) { s2 = new userrec; - strlcpy(s2->nick,Config->ServerName,NICKMAX); + strlcpy(s2->nick,Config->ServerName,NICKMAX-1); strlcpy(s2->modes,"o",52); s2->fd = -1; source = s2; diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index b4d8520cb..b4b70961b 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -168,7 +168,7 @@ class ModuleSQLOper : public Module if(HostName != "") Srv->ChangeHost(user,HostName); - strlcpy(user->oper,rowresult->GetField("type").c_str(),NICKMAX); + strlcpy(user->oper,rowresult->GetField("type").c_str(),NICKMAX-1); WriteOpers("*** %s (%s@%s) is now an IRC operator of type %s",user->nick,user->ident,user->host,rowresult->GetField("type").c_str()); WriteServ(user->fd,"381 %s :You are now an IRC operator of type %s",user->nick,rowresult->GetField("type").c_str()); if(!strchr(user->modes,'o')) diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index a70cb4976..1577a6a0e 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -896,7 +896,7 @@ class TreeSocket : public InspSocket { std::string oldtopic = c->topic; strlcpy(c->topic,params[3].c_str(),MAXTOPIC); - strlcpy(c->setby,params[2].c_str(),NICKMAX); + strlcpy(c->setby,params[2].c_str(),NICKMAX-1); c->topicset = ts; /* if the topic text is the same as the current topic, * dont bother to send the TOPIC command out, just silently @@ -1091,7 +1091,7 @@ class TreeSocket : public InspSocket clientlist[tempnick] = new userrec(); clientlist[tempnick]->fd = FD_MAGIC_NUMBER; - strlcpy(clientlist[tempnick]->nick, tempnick,NICKMAX); + strlcpy(clientlist[tempnick]->nick, tempnick,NICKMAX-1); strlcpy(clientlist[tempnick]->host, params[2].c_str(),160); strlcpy(clientlist[tempnick]->dhost, params[3].c_str(),160); clientlist[tempnick]->server = (char*)FindServerNamePtr(source.c_str()); @@ -1444,7 +1444,7 @@ class TreeSocket : public InspSocket userrec* u = Srv->FindNick(prefix); if (u) { - strlcpy(u->oper,opertype.c_str(),NICKMAX); + strlcpy(u->oper,opertype.c_str(),NICKMAX-1); if (!strchr(u->modes,'o')) { strcat(u->modes,"o"); diff --git a/src/users.cpp b/src/users.cpp index a4be86c9e..3acc8f2a0 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -519,7 +519,7 @@ void AddWhoWas(userrec* u) { whowas_hash::iterator iter = whowas.find(u->nick); WhoWasUser *a = new WhoWasUser(); - strlcpy(a->nick,u->nick,NICKMAX); + strlcpy(a->nick,u->nick,NICKMAX-1); strlcpy(a->ident,u->ident,IDENTMAX); strlcpy(a->dhost,u->dhost,160); strlcpy(a->host,u->host,160); @@ -608,7 +608,7 @@ void AddClient(int socket, int port, bool iscached, in_addr ip4) log(DEBUG,"AddClient: %d %d %s",socket,port,ipaddr); clientlist[tempnick]->fd = socket; - strlcpy(clientlist[tempnick]->nick, tn2,NICKMAX); + strlcpy(clientlist[tempnick]->nick, tn2,NICKMAX-1); /* We don't know the host yet, dns lookup could still be going on, * so instead we just put the ip address here, for now. */ -- cgit v1.2.3