DragonFlyBSD Kernel Audit
DF-0109 / fix.diff
← back to finding ↓ download raw
--- a/sys/kern/subr_disklabel32.c
+++ b/sys/kern/subr_disklabel32.c
@@ -589,7 +589,8 @@
 	if (lp->d_secpercyl <= 0)
 		return ("fixlabel: d_secpercyl <= 0");
 	pp -= RAW_PART;
-	warned = FALSE;
+	if (lp->d_npartitions > MAXPARTITIONS32)
+		lp->d_npartitions = MAXPARTITIONS32;
+	warned = FALSE;
 	for (part = 0; part < lp->d_npartitions; part++, pp++) {