1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Add validation of name and uuid

Do not accept NULL pointers.
This commit is contained in:
Zdenek Kabelac 2012-02-10 14:42:28 +00:00
parent 2c711a2502
commit 3b5834d78b
2 changed files with 6 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.70 -
===================================
Validate name and uuid params of dm_tree_add_new_dev_with_udev_flags().
Do not crash for dm_report_init() sort_key == NULL and behave like "".
Return error for failing allocation in dm_asprintf().
Add missing test for failing allocation in dm_realloc() code.

View File

@ -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))) {