Permalink
Browse files

merge revision(s) 30302:

	* lib/resolv.rb (Resolv::IPv4::Regex): make it only accept 0 to 255.
	  [ruby-core:29501]


git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7@30303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent 49280db commit 45ae87ba4655323bd02f56c28a188ecc3985ac36 @shyouhei shyouhei committed Dec 23, 2010
Showing with 30 additions and 5 deletions.
  1. +5 −0 ChangeLog
  2. +5 −1 lib/resolv.rb
  3. +16 −0 test/resolv/test_addr.rb
  4. +4 −4 version.h
View
@@ -1,3 +1,8 @@
+Thu Dec 23 12:22:35 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 01:43:01 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* lib/webrick/https.rb: uninitialized instance variables.
View
@@ -2066,7 +2066,11 @@ class IPv4
##
# 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
View
@@ -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
View
@@ -1,15 +1,15 @@
#define RUBY_VERSION "1.8.7"
-#define RUBY_RELEASE_DATE "2010-12-21"
+#define RUBY_RELEASE_DATE "2010-12-23"
#define RUBY_VERSION_CODE 187
-#define RUBY_RELEASE_CODE 20101221
-#define RUBY_PATCHLEVEL 329
+#define RUBY_RELEASE_CODE 20101223
+#define RUBY_PATCHLEVEL 330
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8
#define RUBY_VERSION_TEENY 7
#define RUBY_RELEASE_YEAR 2010
#define RUBY_RELEASE_MONTH 12
-#define RUBY_RELEASE_DAY 21
+#define RUBY_RELEASE_DAY 23
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];

0 comments on commit 45ae87b

Please sign in to comment.