Fix format load_address for 32 bits architectures
authorSophie Brun <sophie@freexian.com>
Tue, 6 Feb 2018 15:29:11 +0000 (15:29 +0000)
committerRaphaël Hertzog <hertzog@debian.org>
Tue, 6 Feb 2018 15:29:11 +0000 (15:29 +0000)
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=881997
Forwarded: https://bugs.chromium.org/p/chromium/issues/detail?id=786969
Last-Update: 2017-11-20

The offset and load_address are 64bits integers
On 32bits we have to use strtoull (instead of strtoul) to parse number
into 64bits unsigned integers. Without this the parsed numbers are
truncated to 2^32-1.
Last-Update: 2017-11-20
Gbp-Pq: Name 0013-fix-format-load-address.patch

futility/cmd_bdb.c

index 491f7cfeda21693386a260c8f807536d3df23b99..d982fa2c3b8d6aa8645d32ff06a7d94e81202019 100644 (file)
@@ -637,7 +637,7 @@ static int do_bdb(int argc, char *argv[])
                        }
                        break;
                case OPT_OFFSET:
-                       offset = strtoul(optarg, &e, 0);
+                       offset = strtoull(optarg, &e, 0);
                        if (!*optarg || (e && *e)) {
                                fprintf(stderr, "Invalid --offset\n");
                                parse_error = 1;
@@ -658,7 +658,7 @@ static int do_bdb(int argc, char *argv[])
                        }
                        break;
                case OPT_LOAD_ADDRESS:
-                       load_address = strtoul(optarg, &e, 0);
+                       load_address = strtoull(optarg, &e, 0);
                        if (!*optarg || (e && *e)) {
                                fprintf(stderr, "Invalid --load_address\n");
                                parse_error = 1;