summaryrefslogtreecommitdiff
path: root/ext/dl/lib/dl/func.rb
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-14 11:06:58 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-14 11:06:58 +0000
commitc7d7ff45f1e0d6fad28e53c02108d4b067e843c3 (patch)
treed60cb2e9a20860bff7c8acc9422b7f1221b288dc /ext/dl/lib/dl/func.rb
parent912c16db3dae29fb473152d8861ec7afcf2964b7 (diff)
* ext/dl/lib/dl/func.rb (DL::Function#call): check tainted when
$SAFE > 0. * ext/fiddle/function.c (function_call): check tainted when $SAFE > 0. * test/fiddle/test_func.rb (module Fiddle): add test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/lib/dl/func.rb')
-rw-r--r--ext/dl/lib/dl/func.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/dl/lib/dl/func.rb b/ext/dl/lib/dl/func.rb
index a2e5038..543711f 100644
--- a/ext/dl/lib/dl/func.rb
+++ b/ext/dl/lib/dl/func.rb
@@ -92,6 +92,9 @@ module DL
super
else
funcs = []
+ if $SAFE >= 1 && args.any? { |x| x.tainted? }
+ raise SecurityError, "tainted parameter not allowed"
+ end
_args = wrap_args(args, @stack.types, funcs, &block)
r = @cfunc.call(@stack.pack(_args))
funcs.each{|f| f.unbind_at_call()}