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

libdm: check for size when opening control node

Use dm_snprintf() to detect fail if open_control node would
not have fit into buffer.
This commit is contained in:
Zdenek Kabelac 2014-04-04 21:46:45 +02:00
parent 583fbdba84
commit 2c28197630
2 changed files with 3 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.85 -
===================================
Check for sprintf error when creating path for dm control node.
When buffer for dm_get_library_version() is too small, return error code.
Always reinitialize _name_mangling_mode in dm_lib_init().
Add tracking flag about implicitly added devices into dm_tree.

View File

@ -380,7 +380,8 @@ static int _open_control(void)
if (!_uname())
return 0;
snprintf(control, sizeof(control), "%s/%s", dm_dir(), DM_CONTROL_NODE);
if (dm_snprintf(control, sizeof(control), "%s/%s", dm_dir(), DM_CONTROL_NODE) < 0)
goto_bad;
/*
* Prior to 2.6.36 the minor number should be looked up in /proc.