DragonFlyBSD Kernel Audit
DF-1031 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/platform/vkernel64/platform/init.c b/sys/platform/vkernel64/platform/init.c
--- a/sys/platform/vkernel64/platform/init.c
+++ b/sys/platform/vkernel64/platform/init.c
@@ -875,7 +875,7 @@
 				err(1, "Unable to open/create %s", fname);
 				/* NOT REACHED */
 			}
-			if (S_ISREG(st.st_mode) && (diskFlags[i] & 1) == 0) {
+			if (diskFlags != NULL && S_ISREG(st.st_mode) && (diskFlags[i] & 1) == 0) {
 				if (flock(fd, LOCK_EX|LOCK_NB) < 0) {
 					errx(1, "Disk image %s is already "
 						"in use\n", fname);
@@ -889,7 +889,7 @@
 			info->unit = i;
 			info->fd = fd;
 			info->type = type;
-			info->flags = diskFlags[i];
+			info->flags = (diskFlags != NULL) ? diskFlags[i] : 0;
 			memcpy(info->fname, fname, l);
 			info->serno = NULL;
 			if (serno) {