aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-07-02 11:55:52 -0600
committerSean Griffin <sean@thoughtbot.com>2014-07-02 12:04:56 -0600
commit664feb2d002501bd4a6db42f75b2221d4b9410cc (patch)
tree5eebace68433643c7cb14ef0b33a8c31da0b6be4 /activerecord/lib/active_record/connection_adapters/postgresql
parent7df68a300c9395e3edf8c603b6fea3db9eaff003 (diff)
downloadrails-664feb2d002501bd4a6db42f75b2221d4b9410cc.tar.gz
rails-664feb2d002501bd4a6db42f75b2221d4b9410cc.tar.bz2
rails-664feb2d002501bd4a6db42f75b2221d4b9410cc.zip
Quote range strings when quoting PG ranges
The test case for CVE-2014-3483 doesn't actually send the generated SQL to the database. The generated SQL is actually invalid for real inputs.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb
index cb1c67495b..60b0ee526e 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb
@@ -24,7 +24,7 @@ module ActiveRecord
when Range
if /range$/ =~ sql_type
escaped = quote_string(PostgreSQLColumn.range_to_string(value))
- "#{escaped}::#{sql_type}"
+ "'#{escaped}'::#{sql_type}"
else
super
end