aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-28 20:31:10 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-28 20:31:10 +0000
commita3b53cd9919ff01567ef04af4057b3dec3192471 (patch)
tree491c726a82fdafabffc33c73a88f2af12b7ee83e /lib
parentd21c54ffbd080645e4f64e01e7859775e22707b7 (diff)
downloadruby-a3b53cd9919ff01567ef04af4057b3dec3192471.tar.gz
Resolv::IPv6.create: avoid modifying frozen string literal
* lib/resolv.rb (Resolv::IPv6.create): avoid modifying frozen * test/resolv/test_dns.rb (test_ipv6_create): test for above [Bug #11910] [ruby-core:72559] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/resolv.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/resolv.rb b/lib/resolv.rb
index 61bed16b3f..9a981b99bd 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -2451,14 +2451,14 @@ class Resolv
when IPv6
return arg
when String
- address = ''
+ address = ''.b
if Regex_8Hex =~ arg
arg.scan(/[0-9A-Fa-f]+/) {|hex| address << [hex.hex].pack('n')}
elsif Regex_CompressedHex =~ arg
prefix = $1
suffix = $2
- a1 = ''
- a2 = ''
+ a1 = ''.b
+ a2 = ''.b
prefix.scan(/[0-9A-Fa-f]+/) {|hex| a1 << [hex.hex].pack('n')}
suffix.scan(/[0-9A-Fa-f]+/) {|hex| a2 << [hex.hex].pack('n')}
omitlen = 16 - a1.length - a2.length
@@ -2474,8 +2474,8 @@ class Resolv
elsif Regex_CompressedHex4Dec =~ arg
prefix, suffix, a, b, c, d = $1, $2, $3.to_i, $4.to_i, $5.to_i, $6.to_i
if (0..255) === a && (0..255) === b && (0..255) === c && (0..255) === d
- a1 = ''
- a2 = ''
+ a1 = ''.b
+ a2 = ''.b
prefix.scan(/[0-9A-Fa-f]+/) {|hex| a1 << [hex.hex].pack('n')}
suffix.scan(/[0-9A-Fa-f]+/) {|hex| a2 << [hex.hex].pack('n')}
omitlen = 12 - a1.length - a2.length