Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/sysinst Avoid integer arithmetic overflow when chec...
details: https://anonhg.NetBSD.org/src/rev/97fd471a91d0
branches: trunk
changeset: 366745:97fd471a91d0
user: martin <martin%NetBSD.org@localhost>
date: Sat Jun 11 18:27:22 2022 +0000
description:
Avoid integer arithmetic overflow when checking a partition table without
any partitions.
Fix some comments.
diffstat:
usr.sbin/sysinst/label.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (37 lines):
diff -r e7af808ca1f3 -r 97fd471a91d0 usr.sbin/sysinst/label.c
--- a/usr.sbin/sysinst/label.c Sat Jun 11 18:17:00 2022 +0000
+++ b/usr.sbin/sysinst/label.c Sat Jun 11 18:27:22 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: label.c,v 1.35 2022/06/11 15:41:19 martin Exp $ */
+/* $NetBSD: label.c,v 1.36 2022/06/11 18:27:22 martin Exp $ */
/*
* Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: label.c,v 1.35 2022/06/11 15:41:19 martin Exp $");
+__RCSID("$NetBSD: label.c,v 1.36 2022/06/11 18:27:22 martin Exp $");
#endif
#include <sys/types.h>
@@ -101,7 +101,7 @@
/*
* Check partitioning for overlapping partitions.
- * Returns 0 if no overlapping partition found, nonzero otherwise.
+ * Returns true if no overlapping partition found.
* Sets reference arguments ovly1 and ovly2 to the indices of
* overlapping partitions if any are found.
*/
@@ -114,6 +114,9 @@
daddr_t istart, iend, jstart, jend;
unsigned int fs_type, fs_sub_type;
+ if (parts->num_part == 0)
+ return true;
+
for (i = 0; i < parts->num_part - 1; i ++ ) {
if (!parts->pscheme->get_part_info(parts, i, &info))
continue;
Home |
Main Index |
Thread Index |
Old Index