1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-21 22:04:19 +03:00

cov: split check for type assignment

Check that type is always defined, if not make it explicit internal
error (although logged as debug - so catched only with proper lvm.conf
setting).
This ensures later type being NULL can't be dereferenced with coredump.
This commit is contained in:
Zdenek Kabelac 2018-11-01 15:33:34 +01:00
parent 6235861e64
commit 79879bd201

View File

@ -748,10 +748,11 @@ static void _display_fields_more(struct dm_report *rh,
id_len = strlen(type->prefix) + 3; id_len = strlen(type->prefix) + 3;
for (f = 0; fields[f].report_fn; f++) { for (f = 0; fields[f].report_fn; f++) {
if ((type = _find_type(rh, fields[f].type)) && type->desc) if (!(type = _find_type(rh, fields[f].type))) {
desc = type->desc; log_debug(INTERNAL_ERROR "Field type undefined.");
else continue;
desc = " "; }
desc = (type->desc) ? : " ";
if (desc != last_desc) { if (desc != last_desc) {
if (*last_desc) if (*last_desc)
log_warn(" "); log_warn(" ");