diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-05-30 15:33:06 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-05-30 15:33:06 +0000 |
commit | 3912e4fa3b8694e7de93866fb9aac408cc8bfa4d (patch) | |
tree | 3d3ad52fa8d8b3a3345dad40a94041eb8851ad6c /test/socket/test_addrinfo.rb | |
parent | 77a8772b11c59c50c2edbdd590aa0778bab2fe3a (diff) | |
download | ruby-3912e4fa3b8694e7de93866fb9aac408cc8bfa4d.tar.gz |
* ext/socket/raddrinfo.c (host_str, port_str): Use StringValueCStr
instead of (Safe)StringValue, to detect NUL byte in the string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/socket/test_addrinfo.rb')
-rw-r--r-- | test/socket/test_addrinfo.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/socket/test_addrinfo.rb b/test/socket/test_addrinfo.rb index e010731af8..132d172380 100644 --- a/test/socket/test_addrinfo.rb +++ b/test/socket/test_addrinfo.rb @@ -42,6 +42,9 @@ class TestSocketAddrinfo < Test::Unit::TestCase Addrinfo.ip(addr) end assert_equal([0, "127.0.0.1"], Socket.unpack_sockaddr_in(ai)) + assert_raise(ArgumentError) do + Addrinfo.ip("127.0.0.1\000x") + end end def test_addrinfo_tcp @@ -56,6 +59,9 @@ class TestSocketAddrinfo < Test::Unit::TestCase Addrinfo.tcp("127.0.0.1", "0000000000000000000000080x".chop) end assert_equal([80, "127.0.0.1"], Socket.unpack_sockaddr_in(ai)) + assert_raise(ArgumentError) do + Addrinfo.ip("127.0.0.1", "80\000x") + end end def test_addrinfo_udp |