From 3f4f82c0d7791bddf2d6f2c29d9f2f8c48c712e2 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Mon, 22 Jan 2024 21:05:58 -0500 Subject: [PATCH] bsdlabel: limit to 8 partitions bsdlabel is intended to support up to 20 partitions, but the disklabel struct has a d_partitions array with only BSD_NPARTS_MIN (8) entries. Previously, an attempt to operate on a bsdlabel with more than eight partitions resulted in a buffer overflow. As a stopgap limit bsdlabel to 8 partitions until this is fixed properly. PR: 276517 --- sbin/bsdlabel/bsdlabel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c index 2c03117e344..b831c8ba4ec 100644 --- a/sbin/bsdlabel/bsdlabel.c +++ b/sbin/bsdlabel/bsdlabel.c @@ -50,7 +50,7 @@ #include #define DKTYPENAMES #define FSTYPENAMES -#define MAXPARTITIONS 20 +#define MAXPARTITIONS 8 /* XXX should be 20, but see PR276517 */ #include #include