aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2024-01-23 02:05:58 +0000
committerEd Maste <emaste@FreeBSD.org>2024-03-22 18:45:13 +0000
commita59eba2caacf82f741e8bbc334b2382c615744df (patch)
treed06e25a5d3a26d808a57d62e1d658e5d4744426a
parent806e51f81dbae21feb6e7ddd95d2ed2a28b04f8f (diff)
downloadsrc-a59eba2caacf82f741e8bbc334b2382c615744df.tar.gz
src-a59eba2caacf82f741e8bbc334b2382c615744df.zip
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 (cherry picked from commit 3f4f82c0d7791bddf2d6f2c29d9f2f8c48c712e2) (cherry picked from commit a323dd42bcacdcd6b710fb90ba6691c6ce60cd3d)
-rw-r--r--sbin/bsdlabel/bsdlabel.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c
index 7c7a5bbd6219..5f45039caecb 100644
--- a/sbin/bsdlabel/bsdlabel.c
+++ b/sbin/bsdlabel/bsdlabel.c
@@ -63,7 +63,7 @@ static char sccsid[] = "@(#)disklabel.c 8.2 (Berkeley) 1/7/94";
#include <sys/disk.h>
#define DKTYPENAMES
#define FSTYPENAMES
-#define MAXPARTITIONS 20
+#define MAXPARTITIONS 8 /* XXX should be 20, but see PR276517 */
#include <sys/disklabel.h>
#include <unistd.h>