Ruby: Fix StringSubstitutionCall charpred

Some missing parens meant this class targeted way more things than
intended.
This commit is contained in:
Harry Maclean
2024-05-01 16:13:39 +01:00
parent 397e641f2f
commit f7fc2e0b00
2 changed files with 10 additions and 3 deletions

View File

@@ -19,9 +19,11 @@ class StringSubstitutionCall extends DataFlow::CallNode {
StringSubstitutionCall() {
this.getMethodName() = ["sub", "sub!", "gsub", "gsub!"] and
exists(this.getReceiver()) and
this.getNumberOfArguments() = 2
or
this.getNumberOfArguments() = 1 and exists(this.getBlock())
(
this.getNumberOfArguments() = 2
or
this.getNumberOfArguments() = 1 and exists(this.getBlock())
)
}
/**