ruby-changes:58064
From: nagachika <ko1@a...>
Date: Tue, 1 Oct 2019 20:03:22 +0900 (JST)
Subject: [ruby-changes:58064] 529100b8d7 (ruby_2_6): merge revision(s) a0a2640b398cffd351f87d3f6243103add66575b:
https://git.ruby-lang.org/ruby.git/commit/?id=529100b8d7 From 529100b8d715f07e8f2520460eaca044bc0b5317 Mon Sep 17 00:00:00 2001 From: nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> Date: Tue, 1 Oct 2019 10:56:11 +0000 Subject: merge revision(s) a0a2640b398cffd351f87d3f6243103add66575b: Fix for wrong fnmatch patttern * dir.c (file_s_fnmatch): ensure that pattern does not contain a NUL character. https://hackerone.com/reports/449617 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e diff --git a/dir.c b/dir.c index 69b53cb..3816751 100644 --- a/dir.c +++ b/dir.c @@ -3230,7 +3230,7 @@ file_s_fnmatch(int argc, VALUE *argv, VALUE obj) https://github.com/ruby/ruby/blob/trunk/dir.c#L3230 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 f594a00..16f1076 100644 --- a/test/ruby/test_fnmatch.rb +++ b/test/ruby/test_fnmatch.rb @@ -160,4 +160,10 @@ class TestFnmatch < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_fnmatch.rb#L160 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 61b7a7b..da5842c 100644 --- a/version.h +++ b/version.h @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L1 #define RUBY_VERSION "2.6.5" #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 110 +#define RUBY_PATCHLEVEL 111 #define RUBY_RELEASE_YEAR 2019 -#define RUBY_RELEASE_MONTH 9 -#define RUBY_RELEASE_DAY 28 +#define RUBY_RELEASE_MONTH 10 +#define RUBY_RELEASE_DAY 1 #include "ruby/version.h" -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/