summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/dir.c b/dir.c
index ed42213d17..b2f438e475 100644
--- a/dir.c
+++ b/dir.c
@@ -493,8 +493,12 @@ static VALUE
dir_s_getwd(dir)
VALUE dir;
{
- char *path = my_getcwd();
- VALUE cwd = rb_tainted_str_new2(path);
+ char *path;
+ VALUE cwd;
+
+ rb_secure(4);
+ path = my_getcwd();
+ cwd = rb_tainted_str_new2(path);
free(path);
return cwd;