Skip to content

Commit 196d4a7

Browse files
committed
merge revision(s) 30302:
* 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_7@30303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 2d0d54f commit 196d4a7

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Thu Dec 23 12:22:35 2010 Tanaka Akira <akr@fsij.org>
2+
3+
* lib/resolv.rb (Resolv::IPv4::Regex): make it only accept 0 to 255.
4+
[ruby-core:29501]
5+
16
Tue Dec 21 01:43:01 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
27

38
* lib/webrick/https.rb: uninitialized instance variables.

lib/resolv.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,7 +2066,11 @@ class IPv4
20662066
##
20672067
# Regular expression IPv4 addresses must match.
20682068

2069-
Regex = /\A(\d+)\.(\d+)\.(\d+)\.(\d+)\z/
2069+
Regex256 = /0
2070+
|1(?:[0-9][0-9]?)?
2071+
|2(?:[0-4][0-9]?|5[0-5]?|[6-9])?
2072+
|[3-9][0-9]?/x
2073+
Regex = /\A(#{Regex256})\.(#{Regex256})\.(#{Regex256})\.(#{Regex256})\z/
20702074

20712075
def self.create(arg)
20722076
case arg

test/resolv/test_addr.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
require 'test/unit'
2+
require 'resolv'
3+
require 'socket'
4+
5+
class TestResolvAddr < Test::Unit::TestCase
6+
def test_invalid_ipv4_address
7+
assert(Resolv::IPv4::Regex !~ "1.2.3.256", "[ruby-core:29501]")
8+
1000.times {|i|
9+
if i < 256
10+
assert(Resolv::IPv4::Regex =~ "#{i}.#{i}.#{i}.#{i}")
11+
else
12+
assert(Resolv::IPv4::Regex !~ "#{i}.#{i}.#{i}.#{i}")
13+
end
14+
}
15+
end
16+
end

version.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#define RUBY_VERSION "1.8.7"
2-
#define RUBY_RELEASE_DATE "2010-12-21"
2+
#define RUBY_RELEASE_DATE "2010-12-23"
33
#define RUBY_VERSION_CODE 187
4-
#define RUBY_RELEASE_CODE 20101221
5-
#define RUBY_PATCHLEVEL 329
4+
#define RUBY_RELEASE_CODE 20101223
5+
#define RUBY_PATCHLEVEL 330
66

77
#define RUBY_VERSION_MAJOR 1
88
#define RUBY_VERSION_MINOR 8
99
#define RUBY_VERSION_TEENY 7
1010
#define RUBY_RELEASE_YEAR 2010
1111
#define RUBY_RELEASE_MONTH 12
12-
#define RUBY_RELEASE_DAY 21
12+
#define RUBY_RELEASE_DAY 23
1313

1414
#ifdef RUBY_EXTERN
1515
RUBY_EXTERN const char ruby_version[];

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy