Module Name:    src
Committed By:   tsutsui
Date:           Sun Oct 14 16:20:04 UTC 2012

Modified Files:
        src/sys/arch/x68k/stand/installboot: installboot.c

Log Message:
Check lp->d_npartitions before calling dkcksum()
(which is in src/sbin/disklabel/dkcksum.c) because
it doesn't check range and could cause coredump during
installboot against floppy that includes garbage in LABELSECTOR.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x68k/stand/installboot/installboot.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x68k/stand/installboot/installboot.c
diff -u src/sys/arch/x68k/stand/installboot/installboot.c:1.5 src/sys/arch/x68k/stand/installboot/installboot.c:1.6
--- src/sys/arch/x68k/stand/installboot/installboot.c:1.5	Sat Sep 23 20:10:14 2006
+++ src/sys/arch/x68k/stand/installboot/installboot.c	Sun Oct 14 16:20:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: installboot.c,v 1.5 2006/09/23 20:10:14 pavel Exp $	*/
+/*	$NetBSD: installboot.c,v 1.6 2012/10/14 16:20:04 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2001 Minoura Makoto
@@ -159,7 +159,8 @@ checkparttype(const char *name, int forc
 
 		lp = (struct disklabel *) &bootblock[LABELBYTEOFFSET];
 		memcpy(&label, lp, sizeof(struct disklabel));
-		if (dkcksum(lp) != 0)
+		if (lp->d_npartitions > MAXPARTITIONS ||
+		    dkcksum(lp) != 0)
 			/* there is no valid label */
 			memset(&label, 0, sizeof(struct disklabel));
 	}

Reply via email to