Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/disklabel disallow creation of partitions which start b...



details:   https://anonhg.NetBSD.org/src/rev/ac36b4f3aa46
branches:  trunk
changeset: 533404:ac36b4f3aa46
user:      grant <grant%NetBSD.org@localhost>
date:      Sat Jun 29 15:24:03 2002 +0000

description:
disallow creation of partitions which start beyond (or extend beyond)
the end of the disk.

diffstat:

 sbin/disklabel/interact.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (39 lines):

diff -r eb9d48ea7b2d -r ac36b4f3aa46 sbin/disklabel/interact.c
--- a/sbin/disklabel/interact.c Sat Jun 29 12:33:33 2002 +0000
+++ b/sbin/disklabel/interact.c Sat Jun 29 15:24:03 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: interact.c,v 1.19 2001/10/19 01:16:38 lukem Exp $      */
+/*     $NetBSD: interact.c,v 1.20 2002/06/29 15:24:03 grant Exp $      */
 
 /*
  * Copyright (c) 1997 Christos Zoulas.  All rights reserved.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: interact.c,v 1.19 2001/10/19 01:16:38 lukem Exp $");
+__RCSID("$NetBSD: interact.c,v 1.20 2002/06/29 15:24:03 grant Exp $");
 #endif /* lint */
 
 #include <sys/param.h>
@@ -482,6 +482,9 @@
                if ((i = getnum(lp, line, 0)) == -1) {
                        printf("Bad offset `%s'\n", line);
                        continue;
+               } else if (i > lp->d_secperunit) {
+                       printf("Offset `%s' out of range\n", line);
+                       continue;
                }
                p->p_offset = i;
                break;
@@ -498,6 +501,10 @@
                    == -1) {
                        printf("Bad size `%s'\n", line);
                        continue;
+               } else if
+                   ((i + p->p_offset) > lp->d_secperunit) {
+                       printf("Size `%s' out of range\n", line);
+                       continue;
                }
                p->p_size = i;
                break;



Home | Main Index | Thread Index | Old Index