From 3b5834d78bb05bb3bab0b9cd99cbecd0ad3409fe Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 10 Feb 2012 14:42:28 +0000 Subject: Add validation of name and uuid Do not accept NULL pointers. --- libdm/libdm-deptree.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libdm/libdm-deptree.c') diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index 062d32da..0b16efa2 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -1086,6 +1086,11 @@ struct dm_tree_node *dm_tree_add_new_dev_with_udev_flags(struct dm_tree *dtree, const char *name2; const char *uuid2; + if (!name || !uuid) { + log_error("Cannot add device without name and uuid."); + return NULL; + } + /* Do we need to add node to tree? */ if (!(dnode = dm_tree_find_node_by_uuid(dtree, uuid))) { if (!(name2 = dm_pool_strdup(dtree->mem, name))) { -- cgit