1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +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:
Peter Rajnoha 2013-07-09 13:41:44 +02:00
parent aaa9a68b2f
commit 618d13705c

View File

@ -1251,13 +1251,12 @@ static struct dm_config_value *_get_def_array_values(struct dm_config_tree *cft,
v->type = DM_CFG_FLOAT;
break;
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);
log_error("Failed to duplicate token for default "
"array value of %s.", def->name);
return NULL;
}
memcpy(r, token + 1, strlen(token + 1));
v->v.str = r;
v->type = DM_CFG_STRING;
break;