summaryrefslogtreecommitdiff
path: root/safe.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-23 12:28:16 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-23 12:28:16 +0000
commit8b920b4ac80bf9d7c4193ecff9046b4ae95502e4 (patch)
treef339bc301c0cb845242c5c454132a732a10e8835 /safe.c
parent5be8596447769ece72b58ba21590e83afa622b22 (diff)
* file.c (rb_get_path_check): check with given safe level.
* file.c (rb_find_file_ext_safe, rb_find_file_safe): ditto. * safe.c (rb_insecure_operation): function to raise security error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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);
}