Project

General

Profile

Actions

Backport #3144

closed

resolv-replace Changes IPAddr.new() Behavior, Degrades IP Validation Rules

Added by dotdotdotPaul (Paul Clegg) about 14 years ago. Updated almost 13 years ago.


Description

=begin
By default, calling IPAddr.new("1.2.3.256") results in an ArgumentError exception being raised.

If resolv-replace is require'd, however, the behavior changes; no exception is raised, and an IPAddr object with an IPv4 address of "1.2.3.0" is returned.

This appears to be due to the call to IPSocket.getaddress() being changed to use the Resolv object's getaddress call instead, and it is not raising exceptions on invalid IP addresses the same way.

It seems like the require'ing of resolv-replace should not change the behavior of IPAddr.new(); whether this means the Resolv lib needs to change to be more less forgiving of bogus IP addresses, or the IPAddr lib needs to be less dependent on IPSocket.getaddress(), I'm not sure.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0