diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2019-10-01 12:29:18 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2019-10-01 19:19:56 +0900 |
commit | 3ce238b5f9795581eb84114dcfbdf4aa086bfecc (patch) | |
tree | e1e07f2e4bce0656e624a65df027ac456a7690c7 /lib | |
parent | 36e057e26ef2104bc2349799d6c52d22bb1c7d03 (diff) | |
download | ruby-3ce238b5f9795581eb84114dcfbdf4aa086bfecc.tar.gz |
WEBrick: prevent response splitting and header injection
This is a follow up to d9d4a28f1cdd05a0e8dabb36d747d40bbcc30f16.
The commit prevented CRLR, but did not address an isolated CR or an
isolated LF.
Co-Authored-By: NARUSE, Yui <naruse@airemix.jp>
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 62d8056cf7..f61d53230a 100644 --- a/lib/webrick/httpresponse.rb +++ b/lib/webrick/httpresponse.rb @@ -400,7 +400,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 |