summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-14 11:24:10 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-14 11:24:10 +0000
commitdead0efddba4143116c0d84c87c88e62ef9b8a23 (patch)
treeeec929792c781f6c60871db13f678cf16d06415b /lib
parenta59b02c6bc6d350f08d8cf32f4e27c7222a428a6 (diff)
merge revision(s) 59897:
lib/webrick/log.rb: sanitize any type of logs It had failed to sanitize some type of exception messages. Reported and patched by Yusuke Endoh (mame) at https://hackerone.com/reports/223363 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/webrick/httpstatus.rb4
-rw-r--r--lib/webrick/log.rb4
2 files changed, 2 insertions, 6 deletions
diff --git a/lib/webrick/httpstatus.rb b/lib/webrick/httpstatus.rb
index ded5aa2e60..0630219ada 100644
--- a/lib/webrick/httpstatus.rb
+++ b/lib/webrick/httpstatus.rb
@@ -23,10 +23,6 @@ module WEBrick
##
# Root of the HTTP status class hierarchy
class Status < StandardError
- def initialize(*args) # :nodoc:
- args[0] = AccessLog.escape(args[0]) unless args.empty?
- super(*args)
- end
class << self
attr_reader :code, :reason_phrase # :nodoc:
end
diff --git a/lib/webrick/log.rb b/lib/webrick/log.rb
index 7542d8f79a..41e907cd3b 100644
--- a/lib/webrick/log.rb
+++ b/lib/webrick/log.rb
@@ -118,10 +118,10 @@ module WEBrick
# * Otherwise it will return +arg+.inspect.
def format(arg)
if arg.is_a?(Exception)
- "#{arg.class}: #{arg.message}\n\t" <<
+ "#{arg.class}: #{AccessLog.escape(arg.message)}\n\t" <<
arg.backtrace.join("\n\t") << "\n"
elsif arg.respond_to?(:to_str)
- arg.to_str
+ AccessLog.escape(arg.to_str)
else
arg.inspect
end