Ensure names of public tree IsoNodes are valid POSIX names.
This commit is contained in:
15
src/tree.c
15
src/tree.c
@ -56,6 +56,11 @@ int iso_tree_add_new_dir(IsoDir *parent, const char *name, IsoDir **dir)
|
||||
if (dir) {
|
||||
*dir = NULL;
|
||||
}
|
||||
|
||||
/* check if the name is valid */
|
||||
if (!iso_node_is_valid_name(name)) {
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
|
||||
/* find place where to insert */
|
||||
pos = &(parent->children);
|
||||
@ -140,6 +145,11 @@ int iso_tree_add_new_symlink(IsoDir *parent, const char *name,
|
||||
if (link) {
|
||||
*link = NULL;
|
||||
}
|
||||
|
||||
/* check if the name is valid */
|
||||
if (!iso_node_is_valid_name(name)) {
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
|
||||
/* find place where to insert */
|
||||
pos = &(parent->children);
|
||||
@ -248,6 +258,11 @@ int iso_tree_add_new_special(IsoDir *parent, const char *name, mode_t mode,
|
||||
if (special) {
|
||||
*special = NULL;
|
||||
}
|
||||
|
||||
/* check if the name is valid */
|
||||
if (!iso_node_is_valid_name(name)) {
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
|
||||
/* find place where to insert */
|
||||
pos = &(parent->children);
|
||||
|
Reference in New Issue
Block a user