Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/disklabel CVE 1020933: Prevent integer overflow by usin...



details:   https://anonhg.NetBSD.org/src/rev/675e79363b9e
branches:  trunk
changeset: 786820:675e79363b9e
user:      christos <christos%NetBSD.org@localhost>
date:      Mon May 13 18:01:08 2013 +0000

description:
CVE 1020933: Prevent integer overflow by using wider type

diffstat:

 sbin/disklabel/main.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (59 lines):

diff -r 206e7e4521cd -r 675e79363b9e sbin/disklabel/main.c
--- a/sbin/disklabel/main.c     Mon May 13 17:58:50 2013 +0000
+++ b/sbin/disklabel/main.c     Mon May 13 18:01:08 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.33 2013/05/13 17:58:50 christos Exp $       */
+/*     $NetBSD: main.c,v 1.34 2013/05/13 18:01:08 christos Exp $       */
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
 static char sccsid[] = "@(#)disklabel.c        8.4 (Berkeley) 5/4/95";
 /* from static char sccsid[] = "@(#)disklabel.c        1.2 (Symmetric) 11/28/85"; */
 #else
-__RCSID("$NetBSD: main.c,v 1.33 2013/05/13 17:58:50 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.34 2013/05/13 18:01:08 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -1136,7 +1136,7 @@
 {
        struct disklabel *disk_lp, hlp;
        int i;
-       u_int offset;
+       off_t offset;
        const char *is_deleted;
 
        bootarea_len = pread(f, bootarea, sizeof bootarea,
@@ -1172,19 +1172,19 @@
                        if (target32toh(disk_lp->d_magic) == DISKMAGIC_REV &&
                            target32toh(disk_lp->d_magic2) == DISKMAGIC_REV)
                                warnx("ignoring %sbyteswapped label"
-                                   " at offset %u from sector %u",
+                                   " at offset %td from sector %u",
                                    is_deleted, offset, sector);
                        continue;
                }
                if (target16toh(disk_lp->d_npartitions) > maxpartitions ||
                    dkcksum_target(disk_lp) != 0) {
                        if (verbose > 0)
-                               warnx("corrupt label found at offset %u in "
+                               warnx("corrupt label found at offset %td in "
                                    "sector %u", offset, sector);
                        continue;
                }
                if (verbose > 1)
-                       warnx("%slabel found at offset %u from sector %u",
+                       warnx("%slabel found at offset %td from sector %u",
                            is_deleted, offset, sector);
                if (!read_all)
                        return disk_lp;
@@ -1192,7 +1192,7 @@
                /* To print all the labels we have to do it here */
                /* XXX: maybe we should compare them? */
                targettohlabel(&hlp, disk_lp);
-               printf("# %ssector %u offset %u bytes\n",
+               printf("# %ssector %u offset %td bytes\n",
                    is_deleted, sector, offset);
                if (tflag)
                        makedisktab(stdout, &hlp);



Home | Main Index | Thread Index | Old Index