summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-06-20 11:50:22 -0700
committerJeremy Evans <code@jeremyevans.net>2019-07-29 10:45:14 -0700
commit1a759bfe5d554c22571d2e6e4e5998cf06a7b98f (patch)
tree33666eba5bf775f399fd0ec82a8c772da3bec15b /file.c
parentaa97410b0a85cb4ceb956ab943b5eee92a128411 (diff)
Do not always taint the result of File#path
The result should only be tainted if the path given to the method was tainted. The code to always taint the result was added in a4934a42cbb84b6679912226581c71b435671f55 (svn revision 4892) in 2003 by matz. However, the change wasn't mentioned in the commit message, and it may have been committed by accident. Skip part of a readline test that uses Reline. Reline in general would pass the test, but Reline's test mode doesn't raise a SecurityError if passing a tainted prompt and $SAFE >= 1. This was hidden earlier because File#path was always returning a tainted string. Fixes [Bug #14485]
Diffstat (limited to 'file.c')
-rw-r--r--file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/file.c b/file.c
index 0742c52d660..70f32833ba9 100644
--- a/file.c
+++ b/file.c
@@ -475,7 +475,7 @@ rb_file_path(VALUE obj)
rb_raise(rb_eIOError, "File is unnamed (TMPFILE?)");
}
- return rb_obj_taint(rb_str_dup(fptr->pathv));
+ return rb_str_dup(fptr->pathv);
}
static size_t