summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-03-31 11:35:03 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-03-31 11:35:03 +0200
commit02e935ec7502b70fe85c9676bf8ddf0c15d9337e (patch)
treec8dbee8437fe6a8b9b66d51cdfd70f01aa20c9ef
parent704159e1fc6f71d4edc92ae815fe62a01f9f99fa (diff)
Check if Membership::GetPrefixChar() returns 0 before appending it to a string
Spotted by @barosl
-rw-r--r--src/channels.cpp4
-rw-r--r--src/coremods/core_who.cpp6
-rw-r--r--src/coremods/core_whois.cpp4
-rw-r--r--src/modules/m_check.cpp4
4 files changed, 14 insertions, 4 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index fcfb524ce..c2060b90e 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -664,7 +664,9 @@ void Channel::UserList(User *user)
Membership* memb = i->second;
prefixlist.clear();
- prefixlist.push_back(memb->GetPrefixChar());
+ char prefix = memb->GetPrefixChar();
+ if (prefix)
+ prefixlist.push_back(prefix);
nick = i->first->nick;
FOREACH_MOD(OnNamesListItem, (user, memb, prefixlist, nick));
diff --git a/src/coremods/core_who.cpp b/src/coremods/core_who.cpp
index 670f05a90..2c120e562 100644
--- a/src/coremods/core_who.cpp
+++ b/src/coremods/core_who.cpp
@@ -220,7 +220,11 @@ void CommandWho::SendWhoLine(User* user, const std::vector<std::string>& parms,
}
if (memb)
- wholine.push_back(memb->GetPrefixChar());
+ {
+ char prefix = memb->GetPrefixChar();
+ if (prefix)
+ wholine.push_back(prefix);
+ }
wholine.append(" :0 " + u->fullname);
diff --git a/src/coremods/core_whois.cpp b/src/coremods/core_whois.cpp
index bd0b624d1..934dd2102 100644
--- a/src/coremods/core_whois.cpp
+++ b/src/coremods/core_whois.cpp
@@ -68,7 +68,9 @@ std::string CommandWhois::ChannelList(User* source, User* dest, bool spy)
*/
if (spy != (source == dest || !(c->IsModeSet(privatemode) || c->IsModeSet(secretmode)) || c->HasUser(source)))
{
- list.push_back(memb->GetPrefixChar());
+ char prefix = memb->GetPrefixChar();
+ if (prefix)
+ list.push_back(prefix);
list.append(c->name).push_back(' ');
}
}
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index ad0e2394d..35901f8d5 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -194,7 +194,9 @@ class CommandCheck : public Command
{
Membership* memb = *i;
Channel* c = memb->chan;
- chliststr.push_back(memb->GetPrefixChar());
+ char prefix = memb->GetPrefixChar();
+ if (prefix)
+ chliststr.push_back(prefix);
chliststr.append(c->name).push_back(' ');
}