aboutsummaryrefslogtreecommitdiff
path: root/sbin/fdisk
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>1994-10-25 17:46:53 +0000
committerBruce Evans <bde@FreeBSD.org>1994-10-25 17:46:53 +0000
commitc48cef7def5773a6a69b5a25563838da57377c6d (patch)
tree4495a8ed040bef9cb71932cdb8f0af672f9a1b8c /sbin/fdisk
parent22ab7c84727033660b77fb3aaf57e70fb68ecbba (diff)
downloadsrc-c48cef7def5773a6a69b5a25563838da57377c6d.tar.gz
src-c48cef7def5773a6a69b5a25563838da57377c6d.zip
Don't write outside of partp[] if the user gives an invalid partition
number for the partition to be made active. Do nothing instead. This allows clearing all the active flags by specifying an invalid partition.
Notes
Notes: svn path=/head/; revision=3858
Diffstat (limited to 'sbin/fdisk')
-rw-r--r--sbin/fdisk/fdisk.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c
index cc8b564712f9..f19eedb2abe1 100644
--- a/sbin/fdisk/fdisk.c
+++ b/sbin/fdisk/fdisk.c
@@ -397,7 +397,8 @@ struct dos_partition *partp = ((struct dos_partition *) &mboot.parts);
while (!ok("Are you happy with this choice"));
for (i = 0; i < NDOSPART; i++)
partp[i].dp_flag = 0;
- partp[active].dp_flag = ACTIVE;
+ if (active >= 0 && active < NDOSPART)
+ partp[active].dp_flag = ACTIVE;
}
get_params_to_use()