diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-10-01 11:01:05 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-10-01 11:01:05 +0000 |
commit | f98b3023bd786b4e7dfdb94b573a5f5d3d37d145 (patch) | |
tree | e440ac10ad94eb5abc2cbc8ceac5dca705ea5d05 /lib | |
parent | 05cdcdc6ec7f0777ba56100308e54e97e277293f (diff) |
merge revision(s) 3ce238b5f9795581eb84114dcfbdf4aa086bfecc
WEBrick: prevent response splitting and header injection
This is a follow up to d9d4a28.
The commit prevented CRLR, but did not address an isolated CR or an
isolated LF.
Co-Authored-By: NARUSE, Yui <naruse@airemix.jp>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/webrick/httpresponse.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/webrick/httpresponse.rb b/lib/webrick/httpresponse.rb index 6d77692140..d26324c54a 100644 --- a/lib/webrick/httpresponse.rb +++ b/lib/webrick/httpresponse.rb @@ -367,7 +367,8 @@ module WEBrick private def check_header(header_value) - if header_value =~ /\r\n/ + header_value = header_value.to_s + if /[\r\n]/ =~ header_value raise InvalidHeader else header_value |