aboutsummaryrefslogtreecommitdiffstats
path: root/module/zcommon/zfs_namecheck.c
diff options
context:
space:
mode:
Diffstat (limited to 'module/zcommon/zfs_namecheck.c')
-rw-r--r--module/zcommon/zfs_namecheck.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/module/zcommon/zfs_namecheck.c b/module/zcommon/zfs_namecheck.c
index 58b23b0e0..b1e0de6d8 100644
--- a/module/zcommon/zfs_namecheck.c
+++ b/module/zcommon/zfs_namecheck.c
@@ -232,6 +232,27 @@ entity_namecheck(const char *path, namecheck_err_t *why, char *what)
}
}
+ if (*end == '\0' || *end == '/') {
+ int component_length = end - start;
+ /* Validate the contents of this component is not '.' */
+ if (component_length == 1) {
+ if (start[0] == '.') {
+ if (why)
+ *why = NAME_ERR_SELF_REF;
+ return (-1);
+ }
+ }
+
+ /* Validate the content of this component is not '..' */
+ if (component_length == 2) {
+ if (start[0] == '.' && start[1] == '.') {
+ if (why)
+ *why = NAME_ERR_PARENT_REF;
+ return (-1);
+ }
+ }
+ }
+
/* Snapshot or bookmark delimiter found */
if (*end == '@' || *end == '#') {
/* Multiple delimiters are not allowed */