diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-10-01 11:05:56 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-10-01 11:05:56 +0000 |
commit | 8eff476bce40b52f244b8c912d1a5f40aa64b683 (patch) | |
tree | 651252050ec58296d09e98420b3f92321ca8a2f0 /lib | |
parent | 38d2d0dbd319a9cc49fd2c945be4090cea72ef36 (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_4@67819 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 d1dd1ba141..b64730b2b0 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 |