mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-19 16:58:20 +00:00
Add more checks to bot names to prevent spacing or invalid characters
This commit is contained in:
+8
-3
@@ -1323,7 +1323,7 @@ bool Bot::IsValidName()
|
|||||||
|
|
||||||
bool Bot::IsValidName(std::string& name)
|
bool Bot::IsValidName(std::string& name)
|
||||||
{
|
{
|
||||||
if (name.length() < 4 || name.length() > 15) {
|
if (name.empty() || name.length() < 4 || name.length() > 15) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1332,10 +1332,15 @@ bool Bot::IsValidName(std::string& name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (char c : name.substr(1)) {
|
for (char c : name.substr(1)) {
|
||||||
if (!RuleB(Bots, AllowCamelCaseNames) && !islower(c)) {
|
if (c == '_') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (isdigit(c) || ispunct(c)) {
|
|
||||||
|
if (!isalpha(c)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!RuleB(Bots, AllowCamelCaseNames) && !islower(c)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user