diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-05 09:16:14 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-05 09:16:14 +0000 |
commit | fcb4713286f296a12ec102ebb7637112c38ff74b (patch) | |
tree | 92575ba4cec736acee96b93275cf5ced39484623 /test/socket | |
parent | 84228e93af709300be3085378c1fb9da58ff910f (diff) | |
download | ruby-fcb4713286f296a12ec102ebb7637112c38ff74b.tar.gz ruby-fcb4713286f296a12ec102ebb7637112c38ff74b.tar.xz ruby-fcb4713286f296a12ec102ebb7637112c38ff74b.zip |
* ext/socket/socket.c (sock_s_unpack_sockaddr_in): reject
non-AF_INET/AF_INET6 sockaddr.
(sock_s_unpack_sockaddr_un): reject non-AF_UNIX sockaddr.
[ruby-dev:28691]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@10218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/socket')
-rw-r--r-- | test/socket/test_socket.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/socket/test_socket.rb b/test/socket/test_socket.rb index 954a748b8..4eab094e7 100644 --- a/test/socket/test_socket.rb +++ b/test/socket/test_socket.rb @@ -72,3 +72,12 @@ class TestBasicSocket < Test::Unit::TestCase end end end if defined?(Socket) + +class TestSocket < Test::Unit::TestCase + def test_unpack_sockaddr + sockaddr_in = Socket.sockaddr_in(80, "") + assert_raise(ArgumentError) { Socket.unpack_sockaddr_un(sockaddr_in) } + sockaddr_un = Socket.sockaddr_un("/tmp/s") + assert_raise(ArgumentError) { Socket.unpack_sockaddr_in(sockaddr_un) } + end +end |