mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
config: fix unterminated strings in arrays
...when creating config trees while calling config_def_create_tree fn that constructs a tree out of config_settings.h definition (CFG_DEF_TREE_NEW/MISSING/DEFAULT/PROFILABLE).
This commit is contained in:
parent
aaa9a68b2f
commit
618d13705c
@ -1251,13 +1251,12 @@ static struct dm_config_value *_get_def_array_values(struct dm_config_tree *cft,
|
|||||||
v->type = DM_CFG_FLOAT;
|
v->type = DM_CFG_FLOAT;
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
if (!(r = dm_pool_alloc(cft->mem, strlen(token + 1)))) {
|
if (!(r = dm_pool_strdup(cft->mem, token + 1))) {
|
||||||
dm_free(enc_value);
|
dm_free(enc_value);
|
||||||
log_error("Failed to duplicate token for default "
|
log_error("Failed to duplicate token for default "
|
||||||
"array value of %s.", def->name);
|
"array value of %s.", def->name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memcpy(r, token + 1, strlen(token + 1));
|
|
||||||
v->v.str = r;
|
v->v.str = r;
|
||||||
v->type = DM_CFG_STRING;
|
v->type = DM_CFG_STRING;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user