summaryrefslogtreecommitdiff
path: root/lib/ipaddr.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-23 07:35:14 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-23 07:35:14 +0000
commit2cd1f852e1404462f97a49856b1984d5dd49badc (patch)
treef18e3bac0b90cfc8c4b6dd89306479c5cacd9d17 /lib/ipaddr.rb
parent2697fb4990935d7e6432ef2e142c03d7383264da (diff)
* lib/ipaddr.rb, test/test_ipaddr.rb: Reject invalid address contained
EOL string. Patch by @kachick [fix GH-942][Bug #11513] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/ipaddr.rb')
-rw-r--r--lib/ipaddr.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ipaddr.rb b/lib/ipaddr.rb
index 4b5f784ae0..b0df4d3e6f 100644
--- a/lib/ipaddr.rb
+++ b/lib/ipaddr.rb
@@ -410,7 +410,7 @@ class IPAddr
# Set current netmask to given mask.
def mask!(mask)
if mask.kind_of?(String)
- if mask =~ /^\d+$/
+ if mask =~ /\A\d+\z/
prefixlen = mask.to_i
else
m = IPAddr.new(mask)
@@ -478,7 +478,7 @@ class IPAddr
end
end
prefix, prefixlen = addr.split('/')
- if prefix =~ /^\[(.*)\]$/i
+ if prefix =~ /\A\[(.*)\]\z/i
prefix = $1
family = Socket::AF_INET6
end