mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
merge revision(s) 27388:27390:
* lib/resolv.rb (Resolv::IPv4::Regex): make it only accept 0 to 255. [ruby-core:29501] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@30302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
36f1477f3f
commit
5859f1497e
4 changed files with 30 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Dec 23 12:11:22 2010 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* lib/resolv.rb (Resolv::IPv4::Regex): make it only accept 0 to 255.
|
||||
[ruby-core:29501]
|
||||
|
||||
Tue Dec 21 00:58:21 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||
|
||||
* Backported the fix at
|
||||
|
|
|
@ -2086,7 +2086,11 @@ class Resolv
|
|||
##
|
||||
# Regular expression IPv4 addresses must match.
|
||||
|
||||
Regex = /\A(\d+)\.(\d+)\.(\d+)\.(\d+)\z/
|
||||
Regex256 = /0
|
||||
|1(?:[0-9][0-9]?)?
|
||||
|2(?:[0-4][0-9]?|5[0-5]?|[6-9])?
|
||||
|[3-9][0-9]?/x
|
||||
Regex = /\A(#{Regex256})\.(#{Regex256})\.(#{Regex256})\.(#{Regex256})\z/
|
||||
|
||||
def self.create(arg)
|
||||
case arg
|
||||
|
|
16
test/resolv/test_addr.rb
Normal file
16
test/resolv/test_addr.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
require 'test/unit'
|
||||
require 'resolv'
|
||||
require 'socket'
|
||||
|
||||
class TestResolvAddr < Test::Unit::TestCase
|
||||
def test_invalid_ipv4_address
|
||||
assert(Resolv::IPv4::Regex !~ "1.2.3.256", "[ruby-core:29501]")
|
||||
1000.times {|i|
|
||||
if i < 256
|
||||
assert(Resolv::IPv4::Regex =~ "#{i}.#{i}.#{i}.#{i}")
|
||||
else
|
||||
assert(Resolv::IPv4::Regex !~ "#{i}.#{i}.#{i}.#{i}")
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
|
@ -1,15 +1,15 @@
|
|||
#define RUBY_VERSION "1.8.8"
|
||||
#define RUBY_RELEASE_DATE "2010-12-21"
|
||||
#define RUBY_RELEASE_DATE "2010-12-23"
|
||||
#define RUBY_VERSION_CODE 188
|
||||
#define RUBY_RELEASE_CODE 20101221
|
||||
#define RUBY_PATCHLEVEL -1
|
||||
#define RUBY_RELEASE_CODE 20101223
|
||||
#define RUBY_PATCHLEVEL 1
|
||||
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
#define RUBY_VERSION_MINOR 8
|
||||
#define RUBY_VERSION_TEENY 8
|
||||
#define RUBY_RELEASE_YEAR 2010
|
||||
#define RUBY_RELEASE_MONTH 12
|
||||
#define RUBY_RELEASE_DAY 21
|
||||
#define RUBY_RELEASE_DAY 23
|
||||
|
||||
#define NO_STRING_LITERAL_CONCATENATION 1
|
||||
#ifdef RUBY_EXTERN
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue