e9a1e47
--- lib/cgi.rb  (revision 19665)
e9a1e47
+++ lib/cgi.rb  (working copy)
e9a1e47
@@ -546,6 +546,11 @@
e9a1e47
     when Hash
e9a1e47
       options = options.dup
e9a1e47
     end
e9a1e47
+    options.each_value do |value|
e9a1e47
+      if /\n(?![ \t])/ === value
e9a1e47
+        raise ArgumentError, "potential HTTP header injection detected"
e9a1e47
+      end
e9a1e47
+    end
e9a1e47
e9a1e47
     unless options.has_key?("type")
e9a1e47
       options["type"] = "text/html"