Fix a crash with NAMESX

If we were joining a channel on a server with NAMESX support while a client was
connected that didn't know NAMESX and we received a raw 353 with a trailing
whitespace (UnrealIRCd does this), we were calling std::string::at(0) for an
empty string, which caused some assert to fail and ZNC to die.

This patch fixes this crash bug.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1118 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-07-08 10:00:42 +00:00
parent 9e5ec2d563
commit b141ef44b6
+7 -4
View File
@@ -352,10 +352,13 @@ void CIRCSock::ReadLine(const CString& sData) {
m_pUser->PutUser(sLine, vClients[a]);
} else {
unsigned int i = 0;
// This loop runs once more than there are nicks,
// the last run sets sNick to "" and causes the break.
do {
sNick = sNicks.Token(i);
// This loop runs once for
// every nick on the channel
for (;;) {
sNick = sNicks.Token(i).Trim_n(" ");
if (sNick.empty())
break;
if (m_bNamesx && !vClients[a]->HasNamesx()
&& IsPermChar(sNick[0])) {
// Server has, client hasnt NAMESX,