summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-06 06:55:30 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-06 06:55:30 (GMT)
commite240f49073d7f04eb513d4665b118ed8cdfdb864 (patch)
treea0054c3c8249454ed783ce6a1e8623d77c6028c4 /transcode.c
parent3a6c3a672feeafb46f682b68295dd9a13f5b4725 (diff)
* 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
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/transcode.c b/transcode.c
index 482fb6b..44bed8b 100644
--- a/transcode.c
+++ b/transcode.c
@@ -369,16 +369,19 @@ load_transcoder_entry(transcoder_entry_t *entry)
if (entry->lib) {
const char *lib = entry->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;
entry->lib = NULL;
if (len > MAX_TRANSCODER_LIBNAME_LEN)
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 + sizeof(transcoder_lib_prefix) - 1, lib, len + 1);
- fn = rb_str_new2(path);
+ memcpy(path + sizeof(transcoder_lib_prefix) - 1, lib, len);
+ 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()))