summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-25 07:54:35 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-25 07:54:35 (GMT)
commitfecda0d9f72f52f9777fb32f63eb2471353221ec (patch)
tree9476be67ef8664fb55f7d5b232992b2ff537a661 /transcode.c
parent256f355af5cc3efb543608193da615d5a9fcd340 (diff)
* 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
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/transcode.c b/transcode.c
index 7caad0f..e813516 100644
--- a/transcode.c
+++ b/transcode.c
@@ -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;
}