summaryrefslogtreecommitdiff
path: root/ext/dl/dl.c
diff options
context:
space:
mode:
authorttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-24 07:56:37 +0000
committerttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-24 07:56:37 +0000
commitab7dac4027c063222ad5e4ea68012020f97c047d (patch)
treec5df9566e9f8fd8853275059bf9056a954420d6b /ext/dl/dl.c
parente5282ef182fbd11e2cfd41b752003367320e409f (diff)
Added rb_secure(4). (Thanks to Minero Aoki)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/dl.c')
-rw-r--r--ext/dl/dl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/dl/dl.c b/ext/dl/dl.c
index 0d806a7de78..bfdf5e81a6d 100644
--- a/ext/dl/dl.c
+++ b/ext/dl/dl.c
@@ -542,18 +542,21 @@ rb_io_to_ptr(VALUE self)
VALUE
rb_dl_dlopen(int argc, VALUE argv[], VALUE self)
{
+ rb_secure(4);
return rb_class_new_instance(argc, argv, rb_cDLHandle);
}
VALUE
rb_dl_malloc(VALUE self, VALUE size)
{
+ rb_secure(4);
return rb_dlptr_malloc(DLNUM2LONG(size), dlfree);
}
VALUE
rb_dl_strdup(VALUE self, VALUE str)
{
+ rb_secure(4);
str = rb_String(str);
return rb_dlptr_new(strdup(RSTRING(str)->ptr), RSTRING(str)->len, dlfree);
}
@@ -561,6 +564,7 @@ rb_dl_strdup(VALUE self, VALUE str)
static VALUE
rb_dl_sizeof(VALUE self, VALUE str)
{
+ rb_secure(4);
return INT2NUM(dlsizeof(StringValuePtr(str)));
}
@@ -571,6 +575,7 @@ rb_dl_callback(int argc, VALUE argv[], VALUE self)
int rettype, entry, i;
char fname[127];
+ rb_secure(4);
proc = Qnil;
switch( rb_scan_args(argc, argv, "11", &type, &proc) ){
case 1:
@@ -636,9 +641,11 @@ rb_dl_callback(int argc, VALUE argv[], VALUE self)
static VALUE
rb_dl_remove_callback(VALUE mod, VALUE sym)
{
- freefunc_t f = rb_dlsym2csym(sym);
+ freefunc_t f;
int i, j;
+ rb_secure(4);
+ f = rb_dlsym2csym(sym);
for( i=0; i < CALLBACK_TYPES; i++ ){
for( j=0; j < MAX_CALLBACK; j++ ){
if( rb_dl_callback_table[i][j] == f ){