diff --git a/dir.c b/dir.c index 351d36157a..40bd4eb193 100644 --- a/dir.c +++ b/dir.c @@ -3020,7 +3020,7 @@ file_s_fnmatch(int argc, VALUE *argv, VALUE obj) else flags = 0; - StringValue(pattern); + StringValueCStr(pattern); FilePathStringValue(path); if (flags & FNM_EXTGLOB) { diff --git a/test/ruby/test_fnmatch.rb b/test/ruby/test_fnmatch.rb index ca01a28698..30250b5a19 100644 --- a/test/ruby/test_fnmatch.rb +++ b/test/ruby/test_fnmatch.rb @@ -129,4 +129,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 diff --git a/version.h b/version.h index 25e5741d3b..f8eb732c56 100644 --- a/version.h +++ b/version.h @@ -1,10 +1,10 @@ #define RUBY_VERSION "2.5.7" -#define RUBY_RELEASE_DATE "2019-09-02" -#define RUBY_PATCHLEVEL 202 +#define RUBY_RELEASE_DATE "2019-10-01" +#define RUBY_PATCHLEVEL 203 #define RUBY_RELEASE_YEAR 2019 -#define RUBY_RELEASE_MONTH 9 -#define RUBY_RELEASE_DAY 2 +#define RUBY_RELEASE_MONTH 10 +#define RUBY_RELEASE_DAY 1 #include "ruby/version.h"