Source-Changes-HG archive

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

[src/trunk]: src/dist/pdisk Casting an uint32_t pointer to (long *) may have ...



details:   https://anonhg.NetBSD.org/src/rev/f52c74ad985e
branches:  trunk
changeset: 779889:f52c74ad985e
user:      abs <abs%NetBSD.org@localhost>
date:      Mon Jun 25 16:47:03 2012 +0000

description:
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 3db6d792d528 -r f52c74ad985e dist/pdisk/partition_map.c
--- a/dist/pdisk/partition_map.c        Mon Jun 25 15:30:16 2012 +0000
+++ b/dist/pdisk/partition_map.c        Mon Jun 25 16:47:03 2012 +0000
@@ -514,12 +514,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