1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merge revision(s) a0a2640b39

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_4@67817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2019-10-01 11:04:48 +00:00
parent aca4e654e6
commit 88387876af
3 changed files with 12 additions and 6 deletions

2
dir.c
View file

@ -2655,7 +2655,7 @@ file_s_fnmatch(int argc, VALUE *argv, VALUE obj)
else
flags = 0;
StringValue(pattern);
StringValueCStr(pattern);
FilePathStringValue(path);
if (flags & FNM_EXTGLOB) {

View file

@ -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

View file

@ -1,10 +1,10 @@
#define RUBY_VERSION "2.4.7"
#define RUBY_RELEASE_DATE "2019-08-28"
#define RUBY_PATCHLEVEL 357
#define RUBY_VERSION "2.4.8"
#define RUBY_RELEASE_DATE "2019-10-01"
#define RUBY_PATCHLEVEL 358
#define RUBY_RELEASE_YEAR 2019
#define RUBY_RELEASE_MONTH 8
#define RUBY_RELEASE_DAY 28
#define RUBY_RELEASE_MONTH 10
#define RUBY_RELEASE_DAY 1
#include "ruby/version.h"