Make mdconfig(8) not segfault when the kernel returns garbage data.

MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
This commit is contained in:
Edward Tomasz Napierala 2017-02-19 16:08:58 +00:00
parent 316e092a77
commit 30545786bb

View File

@ -452,8 +452,8 @@ md_list(const char *units, int opt, const char *fflag)
}
gc = &pp->lg_config;
type = geom_config_get(gc, "type");
if (strcmp(type, "vnode") == 0 ||
strcmp(type, "preload") == 0) {
if (type != NULL && (strcmp(type, "vnode") == 0 ||
strcmp(type, "preload") == 0)) {
file = geom_config_get(gc, "file");
if (fflag != NULL &&
strcmp(fflag, file) != 0)