ruby-changes:41083
From: usa <ko1@a...>
Date: Wed, 16 Dec 2015 21:28:35 +0900 (JST)
Subject: [ruby-changes:41083] usa:r53158 (ruby_2_1): fix mistake of previous commit.
usa 2015-12-16 21:28:27 +0900 (Wed, 16 Dec 2015) New Revision: 53158 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53158 Log: fix mistake of previous commit. Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/ext/dl/handle.c branches/ruby_2_1/version.h Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 53157) +++ ruby_2_1/ChangeLog (revision 53158) @@ -5,7 +5,7 @@ Wed Dec 16 21:10:03 2015 CHIKANAGA Tomo https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L5 * test/fiddle/test_handle.rb (class TestHandle): add test for above. -Wed Dec 16 21:10:36 2015 Yuki Sonoda (Yugui) <yugui@y...> +Wed Dec 16 21:10:03 2015 Yuki Sonoda (Yugui) <yugui@y...> * ext/dl/handle.c (rb_dlhandle_initialize): prohibits DL::dlopen with a tainted name of library. Index: ruby_2_1/ext/dl/handle.c =================================================================== --- ruby_2_1/ext/dl/handle.c (revision 53157) +++ ruby_2_1/ext/dl/handle.c (revision 53158) @@ -5,6 +5,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/dl/handle.c#L5 #include <ruby.h> #include "dl.h" +#define SafeStringValuePtr(v) (rb_string_value(&v), rb_check_safe_obj(v), RSTRING_PTR(v)) + VALUE rb_cDLHandle; #ifdef _WIN32 @@ -132,11 +134,11 @@ rb_dlhandle_initialize(int argc, VALUE a https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/dl/handle.c#L134 cflag = RTLD_LAZY | RTLD_GLOBAL; break; case 1: - clib = NIL_P(lib) ? NULL : StringValuePtr(lib); + clib = NIL_P(lib) ? NULL : SafeStringValuePtr(lib); cflag = RTLD_LAZY | RTLD_GLOBAL; break; case 2: - clib = NIL_P(lib) ? NULL : StringValuePtr(lib); + clib = NIL_P(lib) ? NULL : SafeStringValuePtr(lib); cflag = NUM2INT(flag); break; default: @@ -265,13 +267,16 @@ VALUE https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/dl/handle.c#L267 rb_dlhandle_sym(VALUE self, VALUE sym) { struct dl_handle *dlhandle; + const char *name; + + name = SafeStringValuePtr(sym); TypedData_Get_Struct(self, struct dl_handle, &dlhandle_data_type, dlhandle); if( ! dlhandle->open ){ rb_raise(rb_eDLError, "closed handle"); } - return dlhandle_sym(dlhandle->ptr, StringValueCStr(sym)); + return dlhandle_sym(dlhandle->ptr, name); } #ifndef RTLD_NEXT Index: ruby_2_1/version.h =================================================================== --- ruby_2_1/version.h (revision 53157) +++ ruby_2_1/version.h (revision 53158) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.8" #define RUBY_RELEASE_DATE "2015-12-16" -#define RUBY_PATCHLEVEL 439 +#define RUBY_PATCHLEVEL 440 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 12 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/