summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/helperfuncs.cpp15
-rwxr-xr-xsrc/svn-rev.sh2
-rw-r--r--src/users.cpp7
3 files changed, 11 insertions, 13 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 9cf45889f..9080cc6a5 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -1229,9 +1229,11 @@ void userlist(userrec *user,chanrec *c)
return;
}
- snprintf(list,MAXBUF,"353 %s = %s :", user->nick, c->name);
+ size_t dlen = snprintf(list,MAXBUF,"353 %s = %s :", user->nick, c->name);
+ size_t initial = dlen;
std::map<char*,char*> *ulist= c->GetUsers();
+
for (std::map<char*,char*>::iterator i = ulist->begin(); i != ulist->end(); i++)
{
char* o = i->second;
@@ -1242,19 +1244,20 @@ void userlist(userrec *user,chanrec *c)
* nick in NAMES list */
continue;
}
- strlcat(list,cmode(otheruser,c),MAXBUF);
- strlcat(list,otheruser->nick,MAXBUF);
+ dlen += strlcat(list,cmode(otheruser,c),MAXBUF);
+ dlen += strlcat(list,otheruser->nick,MAXBUF);
charlcat(list,' ',MAXBUF);
- if (strlen(list)>(480-NICKMAX))
+ dlen++;
+ if (dlen > (480-NICKMAX))
{
/* list overflowed into
* multiple numerics */
WriteServ_NoFormat(user->fd,list);
- snprintf(list,MAXBUF,"353 %s = %s :", user->nick, c->name);
+ dlen = snprintf(list,MAXBUF,"353 %s = %s :", user->nick, c->name);
}
}
/* if whats left in the list isnt empty, send it */
- if (list[strlen(list)-1] != ':')
+ if (dlen != initial)
{
WriteServ_NoFormat(user->fd,list);
}
diff --git a/src/svn-rev.sh b/src/svn-rev.sh
index 4ec28ae33..0df5e545b 100755
--- a/src/svn-rev.sh
+++ b/src/svn-rev.sh
@@ -1 +1 @@
-echo 3506
+echo 3513
diff --git a/src/users.cpp b/src/users.cpp
index e4d2546a9..516c58e70 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -420,12 +420,7 @@ void kill_link(userrec *user,const char* r)
char reason[MAXBUF];
- strlcpy(reason,r,MAXBUF-1);
-
- if (strlen(reason)>MAXQUIT)
- {
- reason[MAXQUIT-1] = '\0';
- }
+ strlcpy(reason,r,MAXQUIT-1);
log(DEBUG,"kill_link: %s '%s'",user->nick,reason);
Write(user->fd,"ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,reason);