Source-Changes-HG archive

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

[src/netbsd-6]: src/dist/pdisk Pull up revision 1.15 (requested by abs in tic...



details:   https://anonhg.NetBSD.org/src/rev/b0c03dba8478
branches:  netbsd-6
changeset: 774284:b0c03dba8478
user:      jdc <jdc%NetBSD.org@localhost>
date:      Mon Jul 02 21:39:24 2012 +0000

description:
Pull up revision 1.15 (requested by abs in ticket #380).

Casting an uint32_t pointer to (long *) may have been acceptable
in the eighties but that time has long past. Minimally invasive
fix using a temporary long variable, so while we can still overflow
at least we're less broken.

diffstat:

 dist/pdisk/partition_map.c |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (19 lines):

diff -r 869c3b79ceeb -r b0c03dba8478 dist/pdisk/partition_map.c
--- a/dist/pdisk/partition_map.c        Mon Jul 02 21:33:00 2012 +0000
+++ b/dist/pdisk/partition_map.c        Mon Jul 02 21:39:24 2012 +0000
@@ -512,12 +512,14 @@
        default_number = number;
        flush_to_newline(0);
        do {
+           long long_number = number;
            if (get_number_argument("what should be the size? ", 
-                   (long *)&number, default_number) == 0) {
+                   &long_number, default_number) == 0) {
                printf("Not a number\n");
                flush_to_newline(1);
                number = 0;
            } else {
+               number = long_number;
                multiple = get_multiplier(map->logical_block);
                if (multiple == 0) {
                    printf("Bad multiplier\n");



Home | Main Index | Thread Index | Old Index