Module Name: src
Committed By: martin
Date: Mon May 3 23:04:12 UTC 2010
Modified Files:
src/distrib/utils/sysinst: label.c
Log Message:
Prevent a -ve int -> uint32 underflow, noticed by joerg.
If a partition ends up 0-sized, set it to FS_UNUSED to avoid later warnings.
To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/distrib/utils/sysinst/label.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/utils/sysinst/label.c
diff -u src/distrib/utils/sysinst/label.c:1.54 src/distrib/utils/sysinst/label.c:1.55
--- src/distrib/utils/sysinst/label.c:1.54 Sat Jan 2 21:16:46 2010
+++ src/distrib/utils/sysinst/label.c Mon May 3 23:04:12 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: label.c,v 1.54 2010/01/02 21:16:46 dsl Exp $ */
+/* $NetBSD: label.c,v 1.55 2010/05/03 23:04:12 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.54 2010/01/02 21:16:46 dsl Exp $");
+__RCSID("$NetBSD: label.c,v 1.55 2010/05/03 23:04:12 martin Exp $");
#endif
#include <sys/types.h>
@@ -195,6 +195,10 @@
if (size == ~0u)
size = dlsize - p->pi_offset;
p->pi_size = size;
+ if (size == 0) {
+ p->pi_offset = 0;
+ p->pi_fstype = FS_UNUSED;
+ }
return 0;
}
@@ -880,6 +884,8 @@
NULL, isize, 1,
(partend - partstart) / sizemult, multname);
}
+ if (partend < partstart)
+ return 0;
return (partend - partstart);
}
/* NOTREACHED */