mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-09 01:18:39 +03:00
Add some more pointer validation
Ensure _display_name() and _add_dep() would not deref NULL names. Switch to use internal dm_basename().
This commit is contained in:
parent
e922a85c51
commit
d102667b6d
@ -1,5 +1,6 @@
|
|||||||
Version 1.02.73 -
|
Version 1.02.73 -
|
||||||
====================================
|
====================================
|
||||||
|
Add few pointer validation in dmsetup.
|
||||||
Support dm_task_get_driver_version() query without version string.
|
Support dm_task_get_driver_version() query without version string.
|
||||||
Log failure of pthread_join when cleaning unused threads in dmeventd.
|
Log failure of pthread_join when cleaning unused threads in dmeventd.
|
||||||
Fix empty string warning logic in _find_config_str. (1.02.68)
|
Fix empty string warning logic in _find_config_str. (1.02.68)
|
||||||
|
@ -1869,6 +1869,9 @@ static int _display_name(CMD_ARGS)
|
|||||||
{
|
{
|
||||||
char dev_name[PATH_MAX];
|
char dev_name[PATH_MAX];
|
||||||
|
|
||||||
|
if (!names)
|
||||||
|
return 1;
|
||||||
|
|
||||||
if ((_dev_name_type == DN_BLK || _dev_name_type == DN_MAP) &&
|
if ((_dev_name_type == DN_BLK || _dev_name_type == DN_MAP) &&
|
||||||
dm_device_get_name((int) MAJOR(names->dev), (int) MINOR(names->dev),
|
dm_device_get_name((int) MAJOR(names->dev), (int) MINOR(names->dev),
|
||||||
_dev_name_type == DN_BLK, dev_name, PATH_MAX))
|
_dev_name_type == DN_BLK, dev_name, PATH_MAX))
|
||||||
@ -2203,7 +2206,8 @@ static void _display_tree_walk_children(struct dm_tree_node *node,
|
|||||||
|
|
||||||
static int _add_dep(CMD_ARGS)
|
static int _add_dep(CMD_ARGS)
|
||||||
{
|
{
|
||||||
if (!dm_tree_add_dev(_dtree, (unsigned) MAJOR(names->dev), (unsigned) MINOR(names->dev)))
|
if (names &&
|
||||||
|
!dm_tree_add_dev(_dtree, (unsigned) MAJOR(names->dev), (unsigned) MINOR(names->dev)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -3417,7 +3421,8 @@ static int _process_options(const char *options)
|
|||||||
|
|
||||||
static int _process_switches(int *argc, char ***argv, const char *dev_dir)
|
static int _process_switches(int *argc, char ***argv, const char *dev_dir)
|
||||||
{
|
{
|
||||||
char *base, *namebase, *s;
|
const char *base;
|
||||||
|
char *namebase, *s;
|
||||||
static int ind;
|
static int ind;
|
||||||
int c, r;
|
int c, r;
|
||||||
|
|
||||||
@ -3482,7 +3487,7 @@ static int _process_switches(int *argc, char ***argv, const char *dev_dir)
|
|||||||
fprintf(stderr, "Failed to duplicate name.\n");
|
fprintf(stderr, "Failed to duplicate name.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
base = basename(namebase);
|
base = dm_basename(namebase);
|
||||||
|
|
||||||
if (!strcmp(base, "devmap_name")) {
|
if (!strcmp(base, "devmap_name")) {
|
||||||
free(namebase);
|
free(namebase);
|
||||||
|
Loading…
Reference in New Issue
Block a user