summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pttbbs/common/sys/file.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/pttbbs/common/sys/file.c b/pttbbs/common/sys/file.c
index a59c5123..c067779a 100644
--- a/pttbbs/common/sys/file.c
+++ b/pttbbs/common/sys/file.c
@@ -199,6 +199,7 @@ int copy_file(const char *src, const char *dst)
}
#include <signal.h>
+#include <errno.h>
int
Rename(const char *src, const char *dst)
{
@@ -209,6 +210,9 @@ Rename(const char *src, const char *dst)
if (rename(src, dst) == 0)
return 0;
+ if (errno != EXDEV)
+ return -1;
+
// prevent malicious shell escapes
if (strchr(src, ';') || strchr(dst, ';'))
return -1;