Merge pull request #1433 from bfontaine/audit-escape

audit: Escape interpolated string in regexp
This commit is contained in:
Mike McQuaid 2016-11-03 17:35:12 -04:00 committed by GitHub
commit 0028cf9fb8

View File

@ -741,7 +741,7 @@ class FormulaAuditor
end
bin_names.each do |name|
["system", "shell_output", "pipe_output"].each do |cmd|
if text =~ /(def test|test do).*#{cmd}[\(\s]+['"]#{name}[\s'"]/m
if text =~ /(def test|test do).*#{cmd}[\(\s]+['"]#{Regexp.escape name}[\s'"]/m
problem %(fully scope test #{cmd} calls e.g. #{cmd} "\#{bin}/#{name}")
end
end