From fefeb7132968d6e3cdd76d1ea3faf1dc1dcd3ec7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 19 Nov 2011 05:41:17 +0000 Subject: raise ArgumentError if null bytes exist in file path We don't want path names silently truncated when passed to the C API. --- test/test_tdb.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/test_tdb.rb b/test/test_tdb.rb index 7ae581d..9b2ed71 100644 --- a/test/test_tdb.rb +++ b/test/test_tdb.rb @@ -16,6 +16,10 @@ class TestTdb < Test::Unit::TestCase @tdb.close if @tdb && ! @tdb.closed? end + def test_create_file_null_byte_in_path + assert_raises(ArgumentError) { TDB.new("hello.tdb\0") } + end + def test_create_file assert_nothing_raised do @tmp = Tempfile.new('tdb') -- cgit v1.2.3-24-ge0c7