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

vdo: fix parsing vdo status

Recent updates relay on zerod status structure memory (device ptr is
NULL) and also dm_strncpy need to count with '\0'.
This commit is contained in:
Zdenek Kabelac 2018-07-09 00:54:16 +02:00
parent e9d1f676b3
commit 5cf0923e18

View File

@ -188,7 +188,7 @@ bool vdo_status_parse(struct dm_pool *mem, const char *input,
const char *te;
struct vdo_status *s;
s = (!mem) ? malloc(sizeof(*s)) : dm_pool_zalloc(mem, sizeof(*s));
s = (!mem) ? zalloc(sizeof(*s)) : dm_pool_zalloc(mem, sizeof(*s));
if (!s) {
_set_error(result, "out of memory");
@ -206,7 +206,7 @@ bool vdo_status_parse(struct dm_pool *mem, const char *input,
_set_error(result, "out of memory");
goto bad;
}
dm_strncpy(s->device, b, te - b);
dm_strncpy(s->device, b, te - b + 1);
b = _eat_space(te, e);