about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-02-22 15:32:40 -0800
committerEric Wong <normalperson@yhbt.net>2011-02-22 15:39:42 -0800
commit5f1578c0d17b05f5158e467bd3abf18565fe1b4b (patch)
treeb210653369612e3e5360a31eaa42501a8181de2c /test
parenta5491670078b045ced2641649a6cfceee2cade10 (diff)
downloadruby_posix_mq-5f1578c0d17b05f5158e467bd3abf18565fe1b4b.tar.gz
RSTRING_PTR may contain '\0' bytes which makes it unsuitable
for mq_unlink() and mq_open()
Diffstat (limited to 'test')
-rw-r--r--test/test_posix_mq.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_posix_mq.rb b/test/test_posix_mq.rb
index 9587c3a..f7dec3c 100644
--- a/test/test_posix_mq.rb
+++ b/test/test_posix_mq.rb
@@ -25,6 +25,14 @@ class Test_POSIX_MQ < Test::Unit::TestCase
     assert @mq.closed?
   end
 
+  def test_open_with_null_byte
+    assert_raises(ArgumentError) { POSIX_MQ.open("/hello\0world", :rw) }
+  end
+
+  def test_unlink_with_null_byte
+    assert_raises(ArgumentError) { POSIX_MQ.open("/hello\0world", :rw) }
+  end
+
   def test_gc
     assert_nothing_raised do
       2025.times { POSIX_MQ.new(@path, :rw) }