DragonFlyBSD Kernel Audit
DF-1642 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/disk/dm/dm_ioctl.c b/sys/dev/disk/dm/dm_ioctl.c
index 0000000..1111111 100644
--- a/sys/dev/disk/dm/dm_ioctl.c
+++ b/sys/dev/disk/dm/dm_ioctl.c
@@ -1003,7 +1003,7 @@
 	const char *name, *uuid;
 	uint32_t flags, minor;
 	uint64_t table_start, table_end, sector;
-	char *msg;
+	char *msg = NULL;
 	int ret, found = 0;
 
 	flags = 0;
@@ -1025,7 +1025,11 @@
 	}
 
 	/* Get message string */
-	prop_dictionary_get_cstring(dm_dict, DM_MESSAGE_STR, &msg);
+	if (prop_dictionary_get_cstring(dm_dict, DM_MESSAGE_STR, &msg) == false) {
+		dmdebug("dm_message_ioctl: missing message string\n");
+		dm_dev_unbusy(dmv);
+		return EINVAL;
+	}
 
 	tbl = dm_table_get_entry(&dmv->table_head, DM_TABLE_ACTIVE);