Recent updates relay on zerod status structure memory (device ptr is
NULL) and also dm_strncpy need to count with '\0'.
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");
_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);