@@ -22,7 +22,7 @@ static const rb_data_type_t ossl_config_type = {
2222 {
2323 0 , nconf_free ,
2424 },
25- 0 , 0 , RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED ,
25+ 0 , 0 , RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_FROZEN_SHAREABLE ,
2626};
2727
2828CONF *
@@ -87,6 +87,7 @@ config_s_parse(VALUE klass, VALUE str)
8787
8888 bio = ossl_obj2bio (& str );
8989 config_load_bio (conf , bio ); /* Consumes BIO */
90+ rb_obj_freeze (obj );
9091 return obj ;
9192}
9293
@@ -144,6 +145,7 @@ config_initialize(int argc, VALUE *argv, VALUE self)
144145 ossl_raise (eConfigError , "BIO_new_file" );
145146 config_load_bio (conf , bio ); /* Consumes BIO */
146147 }
148+ rb_obj_freeze (self );
147149 return self ;
148150}
149151
@@ -158,6 +160,7 @@ config_initialize_copy(VALUE self, VALUE other)
158160 rb_check_frozen (self );
159161 bio = ossl_obj2bio (& str );
160162 config_load_bio (conf , bio ); /* Consumes BIO */
163+ rb_obj_freeze (self );
161164 return self ;
162165}
163166
@@ -453,6 +456,6 @@ Init_ossl_config(void)
453456 * The default system configuration file for OpenSSL.
454457 */
455458 path = CONF_get1_default_config_file ();
456- path_str = ossl_buf2str (path , rb_long2int (strlen (path )));
459+ path_str = rb_obj_freeze ( ossl_buf2str (path , rb_long2int (strlen (path ) )));
457460 rb_define_const (cConfig , "DEFAULT_CONFIG_FILE" , path_str );
458461}
0 commit comments