Created
October 12, 2011 16:55
-
-
Save simianarmy/1281815 to your computer and use it in GitHub Desktop.
rails_xss gsub bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| str = ActiveSupport::SafeBuffer.new "<script>alert</script>" | |
| CGI::unescapeHTML str | |
| =>TypeError: can't dup NilClass | |
| from /Users/marcm/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/cgi.rb:371:in `dup' | |
| UnescapeHTML chokes b/c $1 = nil on line 371: | |
| 369 def CGI::unescapeHTML(string) | |
| 370 string.gsub(/&(amp|quot|gt|lt|\#[0-9]+|\#x[0-9A-Fa-f]+);/n) do | |
| => 371 match = $1.dup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment