summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-05 05:37:58 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-05 05:37:58 (GMT)
commit3969b1861c344fd37c1c6f59499836c849f098d7 (patch)
tree9ecf861f4018cd9ce24f4f68ae26f8e019070784 /transcode.c
parent4b193223847545cbeacfc518805705a56e756c64 (diff)
transcode.c: fix dangling pointers
* transcode.c (rb_econv_open0): rb_econv_t::source_encoding_name and rb_econv_t::destination_encoding_name should refer static strings always or NULL. [ruby-core:70247] [Bug #11416] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/transcode.c b/transcode.c
index 5e20fd7..25527e1 100644
--- a/transcode.c
+++ b/transcode.c
@@ -993,6 +993,7 @@ rb_econv_open0(const char *sname, const char *dname, int ecflags)
if (*sname == '\0' && *dname == '\0') {
num_trans = 0;
entries = NULL;
+ sname = dname = "";
}
else {
struct trans_open_t toarg;
@@ -3246,10 +3247,10 @@ rb_econv_init_by_convpath(VALUE self, VALUE convpath,
}
if (first) {
- *senc_p = NULL;
- *denc_p = NULL;
- *sname_p = "";
- *dname_p = "";
+ *senc_p = NULL;
+ *denc_p = NULL;
+ *sname_p = "";
+ *dname_p = "";
}
ec->source_encoding_name = *sname_p;