Skip to content

Commit

Permalink
Merge branch 'cve_2019-14894-user_awesomespawn_for_runcmd' into '5.11.z'
Browse files Browse the repository at this point in the history
CVE-2019-14894 fixes to `MiqUtil.runcmd` callers

See merge request cloudforms/cfme!1079

(cherry picked from commit 0c460d0)
  • Loading branch information
Fryguy authored and simaishi committed Feb 27, 2020
1 parent 91176bd commit d896fb3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/evm_database_ops.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def self.backup_destination_free_space(file_location)
FileUtils.mkdir_p(parent_directory)

free_space = begin
output = MiqUtil.runcmd("df -P #{parent_directory}")
cmd_args = {:params => {:P => parent_directory}}
output = MiqUtil.runcmd("df", cmd_args)
data_line = output.split("\n")[1] if output.kind_of?(String)
data_line.split[3].to_i * 1024 if data_line
end
Expand Down
3 changes: 1 addition & 2 deletions lib/miq_apache/control.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ def self.stop
def self.run_apache_cmd(command)
Dir.mkdir(File.dirname(APACHE_CONTROL_LOG)) unless File.exist?(File.dirname(APACHE_CONTROL_LOG))
begin
cmd = "apachectl #{command}"
res = MiqUtil.runcmd(cmd)
res = MiqUtil.runcmd("apachectl", :params => [[command]])
rescue => err
$log.warn("MIQ(MiqApache::Control.run_apache_cmd) Apache command #{command} with result: #{res} failed with error: #{err}") if $log
end
Expand Down
2 changes: 1 addition & 1 deletion lib/miq_environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def self.supports_command?(cmd)

begin
# If 'which apachectl' returns non-zero, it wasn't found
MiqUtil.runcmd("#{which} #{cmd}")
MiqUtil.runcmd(which, :params => [[cmd]])
rescue
false
else
Expand Down

0 comments on commit d896fb3

Please sign in to comment.