[parted-devel] [PATCH 2/2] libparted: fix several integer overflows with dvh labels

Brian C. Lane bcl at redhat.com
Thu Apr 10 00:25:56 UTC 2014


From: Ming Liu <ming.liu at windriver.com>

Integer overflows was found in libparted/labels/dvh.c, while attemptting
assign unsigned int values to int types in some places.

Defined by unsigned int instead.

* libparted/labels/dvh.h: Change int to unsigned int

Signed-off-by: Ming Liu <ming.liu at windriver.com>
Signed-off-by: Brian C. Lane <bcl at redhat.com>
---
 libparted/labels/dvh.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libparted/labels/dvh.h b/libparted/labels/dvh.h
index 4c25c99..7e7fae7 100644
--- a/libparted/labels/dvh.h
+++ b/libparted/labels/dvh.h
@@ -112,8 +112,8 @@ struct device_parameters {
 
 struct volume_directory {
 	char	vd_name[VDNAMESIZE];	/* name */
-	int	vd_lbn;			/* logical block number */
-	int	vd_nbytes;		/* file length in bytes */
+	unsigned int	vd_lbn;			/* logical block number */
+	unsigned int	vd_nbytes;		/* file length in bytes */
 };
 
 /*
@@ -125,9 +125,9 @@ struct volume_directory {
  * NOTE: pt_firstlbn SHOULD BE CYLINDER ALIGNED
  */
 struct partition_table {		/* one per logical partition */
-	int	pt_nblks;		/* # of logical blks in partition */
-	int	pt_firstlbn;		/* first lbn of partition */
-	int	pt_type;		/* use of partition */
+	unsigned int	pt_nblks;		/* # of logical blks in partition */
+	unsigned int	pt_firstlbn;		/* first lbn of partition */
+	int		pt_type;		/* use of partition */
 };
 
 #define	PTYPE_VOLHDR	0		/* partition is volume header */
-- 
1.9.0




More information about the parted-devel mailing list