Commit 9b16bb7603e1fff6b2ca4ecea0907b824bd7f0f9

Further path sanity checking

Commit diff

script/git-daemon

 
5353 if line =~ service_regexp
5454 code = $1
5555 service = $2
56 path = $3
56 base_path = $3
5757 host = $4
5858
59 path = "#{BASE_PATH}/#{path}"
60 if !File.directory?(path)
61 log(Process.pid, "Invalid path: #{path}")
59 path = "#{BASE_PATH}/#{base_path}"
60 if !File.join(File.expand_path(path)).index(BASE_PATH) == 0 || !File.directory?(path)
61 log(Process.pid, "Invalid path: #{base_path}")
6262 session.close
6363 next
6464 end
8080 end
8181 pid = Process.pid
8282 ip_family, port, name, ip = session.peeraddr
83 log(pid, "Connection from #{ip}")
83 log(pid, "Connection from #{ip} for #{path.inspect}")
8484
8585 $stdout.reopen(session)
8686 $stdin.reopen(session)
toggle raw diff