mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
* encoding.c (require_enc): reject only loading from untrusted
load paths. [ruby-dev:44541] [Bug #5279] * transcode.c (load_transcoder_entry): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
256f355af5
commit
fecda0d9f7
4 changed files with 12 additions and 3 deletions
|
@ -370,6 +370,7 @@ load_transcoder_entry(transcoder_entry_t *entry)
|
|||
const size_t total_len = sizeof(transcoder_lib_prefix) - 1 + len;
|
||||
const VALUE fn = rb_str_new(0, total_len);
|
||||
char *const path = RSTRING_PTR(fn);
|
||||
const int safe = rb_safe_level();
|
||||
|
||||
entry->lib = NULL;
|
||||
|
||||
|
@ -378,7 +379,7 @@ load_transcoder_entry(transcoder_entry_t *entry)
|
|||
rb_str_set_len(fn, total_len);
|
||||
FL_UNSET(fn, FL_TAINT|FL_UNTRUSTED);
|
||||
OBJ_FREEZE(fn);
|
||||
if (!rb_require_safe(fn, rb_safe_level()))
|
||||
if (!rb_require_safe(fn, safe > 3 ? 3 : safe))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue