summaryrefslogtreecommitdiff
path: root/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2018-10-18 16:36:54 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2018-11-01 12:39:37 +0100
commit5b63183c901a2d8c052ac5be44486eb090165a19 (patch)
tree69ed8c0cf99bbaf37deace615b0a226331ca2a32 /ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
parent2144f88af24e03879b4c09fe15c5c982d296b7a3 (diff)
mkfs.ubifs: Make sure we catch nodes that should or should not have name
Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'ubifs-utils/mkfs.ubifs/mkfs.ubifs.c')
-rw-r--r--ubifs-utils/mkfs.ubifs/mkfs.ubifs.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
index b402945..8aba668 100644
--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
+++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
@@ -1161,6 +1161,14 @@ static int add_node(union ubifs_key *key, char *name, int name_len, void *node,
{
int err, lnum, offs;
+ if (key_type(key) == UBIFS_DENT_KEY || key_type(key) == UBIFS_XENT_KEY) {
+ if (!name)
+ return err_msg("Directory entry or xattr without name!");
+ } else {
+ if (name)
+ return err_msg("Name given for non dir/xattr node!");
+ }
+
prepare_node(node, len);
err = reserve_space(len, &lnum, &offs);