summaryrefslogtreecommitdiff
path: root/safe.c
diff options
context:
space:
mode:
Diffstat (limited to 'safe.c')
-rw-r--r--safe.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/safe.c b/safe.c
index ebe62f4206..bb725e1394 100644
--- a/safe.c
+++ b/safe.c
@@ -98,16 +98,22 @@ rb_secure_update(VALUE obj)
}
void
+rb_insecure_operation(void)
+{
+ if (rb_frame_callee()) {
+ rb_raise(rb_eSecurityError, "Insecure operation - %s",
+ rb_id2name(rb_frame_callee()));
+ }
+ else {
+ rb_raise(rb_eSecurityError, "Insecure operation: -r");
+ }
+}
+
+void
rb_check_safe_obj(VALUE x)
{
if (rb_safe_level() > 0 && OBJ_TAINTED(x)) {
- if (rb_frame_callee()) {
- rb_raise(rb_eSecurityError, "Insecure operation - %s",
- rb_id2name(rb_frame_callee()));
- }
- else {
- rb_raise(rb_eSecurityError, "Insecure operation: -r");
- }
+ rb_insecure_operation();
}
rb_secure(4);
}