Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 50623aad75f0
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6ef3f3114c0c
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Feb 19, 2017

  1. Use ipaddr to compare the sender's address

    When resolving names using compressed IPv6-only DNS servers, it could
    happen that when processing the response of a name query, the IP of the
    sender is not compressed so using a simple string comparison is not
    safe.
    
    This patch encapsulates the from address and the address of the sender in
    IPAddr objects so the comparison is safe and just works in all cases.
    
    This fixes #3663.
    nbarrientos committed Feb 19, 2017
    Copy the full SHA
    d1a760e View commit details

Commits on Mar 1, 2017

  1. Merge pull request #4496 from nbarrientos/issue3663

    Use ipaddr to compare the sender's address
    headius authored Mar 1, 2017
    Copy the full SHA
    6ef3f31 View commit details
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/ruby/stdlib/resolv.rb
5 changes: 3 additions & 2 deletions lib/ruby/stdlib/resolv.rb
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
require 'timeout'
require 'thread'
require 'io/wait'
require 'ipaddr'

begin
require 'securerandom'
@@ -768,13 +769,13 @@ def initialize(*nameserver_port)

def recv_reply(readable_socks)
reply, from = readable_socks[0].recvfrom(UDPSize)
return reply, [from[3],from[1]]
return reply, [IPAddr.new(from[3]),from[1]]
end

def sender(msg, data, host, port=Port)
sock = @socks_hash[host.index(':') ? "::" : "0.0.0.0"]
return nil if !sock
service = [host, port]
service = [IPAddr.new(host), port]
id = DNS.allocate_request_id(host, port)
request = msg.encode
request[0,2] = [id].pack('n')