summaryrefslogtreecommitdiff
path: root/lib/resolv-replace.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-08 01:58:40 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-08 01:58:40 +0000
commita8a33dcd98577b2cae5f38ce39b7a9d27f028a35 (patch)
tree8722021816a3dfabe811f64626b8fe3377d98ce0 /lib/resolv-replace.rb
parenta2d0d15b711cae6fcc63a5b1b8cceb45946c60d1 (diff)
* lib/resolv.rb: randomize source port and transaction id.
CVE-2008-1447. * lib/resolv-replace.rb (UDPSocket#bind): don't resolv host if host is "". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@18424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/resolv-replace.rb')
-rw-r--r--lib/resolv-replace.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/resolv-replace.rb b/lib/resolv-replace.rb
index 5d15b4577c..63d58cea27 100644
--- a/lib/resolv-replace.rb
+++ b/lib/resolv-replace.rb
@@ -23,7 +23,8 @@ end
class UDPSocket
alias original_resolv_bind bind
def bind(host, port)
- original_resolv_bind(IPSocket.getaddress(host), port)
+ host = IPSocket.getaddress(host) if host != ""
+ original_resolv_bind(host, port)
end
alias original_resolv_connect connect