* transcode.c (load_transcoder_entry): concatenate paths directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3a6c3a672f
commit
e240f49073
@ -1,4 +1,6 @@
|
|||||||
Tue Sep 6 13:15:44 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Tue Sep 6 15:55:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* transcode.c (load_transcoder_entry): concatenate paths directly.
|
||||||
|
|
||||||
* encoding.c (load_encoding): predefined encoding names are safe.
|
* encoding.c (load_encoding): predefined encoding names are safe.
|
||||||
[ruby-dev:44469] [Bug #5279]
|
[ruby-dev:44469] [Bug #5279]
|
||||||
|
@ -369,16 +369,19 @@ load_transcoder_entry(transcoder_entry_t *entry)
|
|||||||
if (entry->lib) {
|
if (entry->lib) {
|
||||||
const char *lib = entry->lib;
|
const char *lib = entry->lib;
|
||||||
size_t len = strlen(lib);
|
size_t len = strlen(lib);
|
||||||
char path[sizeof(transcoder_lib_prefix) + MAX_TRANSCODER_LIBNAME_LEN];
|
size_t total_len = sizeof(transcoder_lib_prefix) - 1 + len;
|
||||||
|
char *path;
|
||||||
VALUE fn;
|
VALUE fn;
|
||||||
|
|
||||||
entry->lib = NULL;
|
entry->lib = NULL;
|
||||||
|
|
||||||
if (len > MAX_TRANSCODER_LIBNAME_LEN)
|
if (len > MAX_TRANSCODER_LIBNAME_LEN)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
fn = rb_str_new(0, total_len);
|
||||||
|
path = RSTRING_PTR(fn);
|
||||||
memcpy(path, transcoder_lib_prefix, sizeof(transcoder_lib_prefix) - 1);
|
memcpy(path, transcoder_lib_prefix, sizeof(transcoder_lib_prefix) - 1);
|
||||||
memcpy(path + sizeof(transcoder_lib_prefix) - 1, lib, len + 1);
|
memcpy(path + sizeof(transcoder_lib_prefix) - 1, lib, len);
|
||||||
fn = rb_str_new2(path);
|
rb_str_set_len(fn, total_len);
|
||||||
FL_UNSET(fn, FL_TAINT|FL_UNTRUSTED);
|
FL_UNSET(fn, FL_TAINT|FL_UNTRUSTED);
|
||||||
OBJ_FREEZE(fn);
|
OBJ_FREEZE(fn);
|
||||||
if (!rb_require_safe(fn, rb_safe_level()))
|
if (!rb_require_safe(fn, rb_safe_level()))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user