mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
Restrict filesystem creation if name referred either '.' or '..'
This change restricts filesystem creation if the given name contains either '.' or '..' Reviewed-by: Matt Ahrens <mahrens@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Richard Elling <Richard.Elling@RichardElling.com> Signed-off-by: TulsiJain <tulsi.jain@delphix.com> Closes #8842 Closes #8564
This commit is contained in:
committed by
Brian Behlendorf
parent
3475724ea4
commit
9c7da9a95a
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user