1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

Fix buffer allocation size for uuid string

We have 3 components and traling '\0' so allocate proper room for all of them.
Problem was nicely hidden by allocation from pool and allocation aligment
offset - so to trigger real problem with this one is actually hard.
This commit is contained in:
Zdenek Kabelac 2011-03-13 22:57:51 +00:00
parent 218f657794
commit c9c1730705
2 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.85 -
===================================
Fix buffer allocation in build_dm_uuid().
Fix readlink usage inside get_primary_dev().
Use format instance mempool where possible and adequate.
Call destroy_instance for any PVs found in VG structure during vg_free call.

View File

@ -229,7 +229,7 @@ char *build_dm_uuid(struct dm_pool *mem, const char *lvid, const char *layer)
if (!layer)
layer = "";
len = sizeof(UUID_PREFIX) + strlen(lvid) + strlen(layer) + 1;
len = sizeof(UUID_PREFIX) + strlen(lvid) + strlen(layer) + 1 + 1;
if (!(dmuuid = dm_pool_alloc(mem, len))) {
log_error("build_dm_name: Allocation failed for %" PRIsize_t