java-topology/defects/bzflag-0003/patch/bzflag-0003.patch

27 lines
1.1 KiB
Diff

# UNDF: UNDF-2026-000000995
--- a/src/bzfs/Permissions.cxx
+++ b/src/bzfs/Permissions.cxx
@@ -536,6 +536,7 @@
// return value is only needed for groupdb parsing, not for userdb.
bool parsePermissionString(const std::string &permissionString, PlayerAccessInfo &info)
{
+ std::set<std::string> customPermsSeen;
if (permissionString.length() < 1)
return false;
@@ -649,10 +650,14 @@
{
// Easy access
std::vector<std::string>& c = info.customPerms;
+ // Populate seen set on first custom perm encounter
+ if (customPermsSeen.empty() && !c.empty())
+ customPermsSeen.insert(c.begin(), c.end());
// Only store the custom permission if it doesn't exist, in order to prevent duplicates
- if (std::find(c.begin(), c.end(), word) == c.end())
+ if (customPermsSeen.find(word) == customPermsSeen.end())
{
+ customPermsSeen.insert(word);
c.push_back(word);
}
}