summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'file.c')
-rw-r--r--file.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/file.c b/file.c
index 1eea9360e4..3016589b91 100644
--- a/file.c
+++ b/file.c
@@ -2304,7 +2304,14 @@ path_check_1(path)
return path_check_1(newpath);
}
for (;;) {
- if (stat(p0, &st) == 0 && (st.st_mode & 002)) {
+#ifndef S_IWOTH
+# define S_IWOTH 002
+#endif
+ if (stat(p0, &st) == 0 && S_ISDIR(st->st_mode) && (st.st_mode & S_IWOTH)
+#ifdef S_ISVTX
+ && !(st.st_mode & S_ISVTX)
+#endif
+ ) {
if (p) *p = '/';
rb_warn("Unsecure world writeable dir %s , mode 0%o", p0, st.st_mode);
return 0;