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
This commit is contained in:
nobu 2015-08-05 05:37:58 +00:00
Родитель 4b19322384
Коммит 3969b1861c
2 изменённых файлов: 11 добавлений и 4 удалений

Просмотреть файл

@ -1,3 +1,9 @@
Wed Aug 5 14:37:55 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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]
Tue Aug 4 16:53:43 2015 Aaron Patterson <tenderlove@ruby-lang.org>
* ext/openssl/lib/openssl/ssl.rb (module OpenSSL): extract callback

Просмотреть файл

@ -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;