Project

General

Profile

0001-fixes-6086-CVE-2014-0007-fixed-TFTP-boot-API-remote-.patch

Lukas Zapletal, 06/12/2014 11:05 AM

View differences:

lib/proxy/tftp.rb
98 98
  class << self
99 99
    include Proxy::Util
100 100
    def fetch_boot_file dst, src
101
      filename    = src.split("/")[-1]
102
      destination = Pathname.new("#{SETTINGS.tftproot}/#{dst}-#{filename}")
101
      filename    = dst + '-' + src.split("/")[-1]
102
      destination = Pathname.new(File.absolute_path(filename, SETTINGS.tftproot)).cleanpath
103
      tftproot    = Pathname.new(SETTINGS.tftproot).cleanpath
104
      raise "TFTP destination outside of tftproot" unless destination.to_s.start_with?(tftproot.to_s)
103 105

  
104 106
      # Ensure that our image directory exists
105 107
      # as the dst might contain another sub directory
106 108
      FileUtils.mkdir_p destination.parent
107 109

  
108 110
      wget = which("wget")
109
      cmd = "#{wget} --timeout=10 --tries=3 --no-check-certificate -nv -c #{src} -O \"#{destination}\""
111
      cmd = "#{wget} --timeout=10 --tries=3 --no-check-certificate -nv -c \"#{escape_for_shell(src)}\" -O \"#{escape_for_shell(destination)}\""
110 112
      CommandTask.new(cmd)
111 113
    end
112 114
  end
113
-