@@ -40,11 +40,13 @@ static VALUE rb_sqlite3_open_v2(VALUE self, VALUE file, VALUE mode, VALUE zvfs)
4040
4141 Data_Get_Struct (self , sqlite3Ruby , ctx );
4242
43+ #if defined TAINTING_SUPPORT
4344#if defined StringValueCStr
4445 StringValuePtr (file );
4546 rb_check_safe_obj (file );
4647#else
4748 Check_SafeStr (file );
49+ #endif
4850#endif
4951
5052 status = sqlite3_open_v2 (
@@ -213,16 +215,16 @@ VALUE sqlite3val2rb(sqlite3_value * val)
213215 return rb_float_new (sqlite3_value_double (val ));
214216 break ;
215217 case SQLITE_TEXT :
216- return rb_tainted_str_new2 ((const char * )sqlite3_value_text (val ));
218+ return rb_str_new2 ((const char * )sqlite3_value_text (val ));
217219 break ;
218220 case SQLITE_BLOB : {
219221 /* Sqlite warns calling sqlite3_value_bytes may invalidate pointer from sqlite3_value_blob,
220222 so we explicitly get the length before getting blob pointer.
221- Note that rb_str_new and rb_tainted_str_new apparently create string with ASCII-8BIT (BINARY) encoding,
223+ Note that rb_str_new apparently create string with ASCII-8BIT (BINARY) encoding,
222224 which is what we want, as blobs are binary
223225 */
224226 int len = sqlite3_value_bytes (val );
225- return rb_tainted_str_new ((const char * )sqlite3_value_blob (val ), len );
227+ return rb_str_new ((const char * )sqlite3_value_blob (val ), len );
226228 break ;
227229 }
228230 case SQLITE_NULL :
@@ -761,11 +763,13 @@ static VALUE rb_sqlite3_open16(VALUE self, VALUE file)
761763
762764 Data_Get_Struct (self , sqlite3Ruby , ctx );
763765
766+ #if defined TAINTING_SUPPORT
764767#if defined StringValueCStr
765768 StringValuePtr (file );
766769 rb_check_safe_obj (file );
767770#else
768771 Check_SafeStr (file );
772+ #endif
769773#endif
770774
771775 status = sqlite3_open16 (utf16_string_value_ptr (file ), & ctx -> db );
0 commit comments