summaryrefslogtreecommitdiff
path: root/debian/patches/libdiskfs-rename.patch
blob: 626d48d1e2c863b1d9a5b9944bb27dfaec3a9e90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
diff --git a/libdiskfs/dir-rename.c b/libdiskfs/dir-rename.c
index 747c666..d0e5b60 100644
--- a/libdiskfs/dir-rename.c
+++ b/libdiskfs/dir-rename.c
@@ -19,6 +19,7 @@
 
 #include "priv.h"
 #include "fs_S.h"
+#include <string.h>
 
 /* To avoid races in checkpath, and to prevent a directory from being
    simultaneously renamed by two processes, we serialize all renames of
@@ -44,6 +45,10 @@ diskfs_S_dir_rename (struct protid *fromcred,
   if (! tocred)
     return EXDEV;
 
+  if (!strcmp (fromname, ".") || !strcmp (fromname, "..")
+   || !strcmp (toname,   ".") || !strcmp (toname,   ".."))
+    return EINVAL;
+
   if (tocred->po->shadow_root != fromcred->po->shadow_root)
     /* Same translator, but in different shadow trees.  */
     return EXDEV;