summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorart <art@openbsd.org>1998-01-05 06:20:48 +0000
committerart <art@openbsd.org>1998-01-05 06:20:48 +0000
commit1ea4ef169cc3318bae4a4ee0a477012758494a87 (patch)
treeabc4839e6bf968692381158951d370726ba1c35a
parenttype repair; nino@well.ox.ac.uk (diff)
downloadwireguard-openbsd-1ea4ef169cc3318bae4a4ee0a477012758494a87.tar.xz
wireguard-openbsd-1ea4ef169cc3318bae4a4ee0a477012758494a87.zip
check if the partitions are below the boundaries and not only above when
counting the free sectors.
-rw-r--r--sbin/disklabel/editor.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c
index 17f86c9f44a..9e962cc6f13 100644
--- a/sbin/disklabel/editor.c
+++ b/sbin/disklabel/editor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: editor.c,v 1.26 1997/11/05 02:48:43 millert Exp $ */
+/* $OpenBSD: editor.c,v 1.27 1998/01/05 06:20:48 art Exp $ */
/*
* Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -31,7 +31,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: editor.c,v 1.26 1997/11/05 02:48:43 millert Exp $";
+static char rcsid[] = "$OpenBSD: editor.c,v 1.27 1998/01/05 06:20:48 art Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -128,7 +128,9 @@ editor(lp, f)
for (i = 0; i < label.d_npartitions; i++) {
pp = &label.d_partitions[i];
if (pp->p_fstype != FS_UNUSED && pp->p_fstype != FS_BOOT &&
- pp->p_size > 0 && pp->p_offset + pp->p_size <= ending_sector)
+ pp->p_size > 0 &&
+ pp->p_offset + pp->p_size <= ending_sector &&
+ pp->p_offset >= starting_sector)
freesectors -= pp->p_size;
}