summaryrefslogtreecommitdiff
path: root/test/ruby/test_fnmatch.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2018-12-12 14:38:09 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-10-01 19:19:56 +0900
commita0a2640b398cffd351f87d3f6243103add66575b (patch)
treea8dc849fe08b67a7a54f081c2654ce2812ad42e4 /test/ruby/test_fnmatch.rb
parenta38fe1fbf068d05177e6e6fac2b8ec7704873e63 (diff)
Fix for wrong fnmatch patttern
* dir.c (file_s_fnmatch): ensure that pattern does not contain a NUL character. https://hackerone.com/reports/449617
Diffstat (limited to 'test/ruby/test_fnmatch.rb')
-rw-r--r--test/ruby/test_fnmatch.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_fnmatch.rb b/test/ruby/test_fnmatch.rb
index f594a00ad3..16f1076e48 100644
--- a/test/ruby/test_fnmatch.rb
+++ b/test/ruby/test_fnmatch.rb
@@ -160,4 +160,10 @@ class TestFnmatch < Test::Unit::TestCase
assert_file.fnmatch("[a-\u3042]*", "\u3042")
assert_file.not_fnmatch("[a-\u3042]*", "\u3043")
end
+
+ def test_nullchar
+ assert_raise(ArgumentError) {
+ File.fnmatch("a\0z", "a")
+ }
+ end
end