DragonFlyBSD Kernel Audit
DF-0135 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/kern/subr_disklabel64.c b/sys/kern/subr_disklabel64.c
--- a/sys/kern/subr_disklabel64.c
+++ b/sys/kern/subr_disklabel64.c
@@ -301,7 +301,8 @@
 			return (EINVAL);
 		if (npp->p_boffset < nlp->d_pbase)
 			return (ENOSPC);
-		if (npp->p_boffset + npp->p_bsize > nlp->d_total_size)
+		if (npp->p_boffset + npp->p_bsize < npp->p_boffset ||
+		    npp->p_boffset + npp->p_bsize > nlp->d_total_size)
 			return (ENOSPC);
 	}