Fix match(), regex(), cidr_match() behaviour with MatchAll and empty arrays

fixes #5634
This commit is contained in:
Michael Friedrich 2017-09-29 14:45:15 +02:00
parent 0ca9a1a5b3
commit c0a3de64fb
1 changed files with 9 additions and 0 deletions

View File

@ -128,6 +128,9 @@ bool ScriptUtils::Regex(const std::vector<Value>& args)
texts->Add(argTexts);
}
if (texts->GetLength() == 0)
return false;
ObjectLock olock(texts);
for (const String& text : texts) {
bool res = false;
@ -171,6 +174,9 @@ bool ScriptUtils::Match(const std::vector<Value>& args)
texts->Add(argTexts);
}
if (texts->GetLength() == 0)
return false;
ObjectLock olock(texts);
for (const String& text : texts) {
bool res = Utility::Match(pattern, text);
@ -207,6 +213,9 @@ bool ScriptUtils::CidrMatch(const std::vector<Value>& args)
ips->Add(argIps);
}
if (ips->GetLength() == 0)
return false;
ObjectLock olock(ips);
for (const String& ip : ips) {
bool res = Utility::CidrMatch(pattern, ip);