From b707e13ca0db5c40cd6cb50634241fd417afa8d1 Mon Sep 17 00:00:00 2001 From: Petr Malat Date: Thu, 15 Dec 2016 14:48:33 +0100 Subject: [PATCH] tests: Use strtoul in test-coredump-unwind.c Read the address using strtoul(). If strtol() is used and the number is bigger than LONG_MAX, LONG_MAX is returned instead, which leads to a failure if the mapping address is 0x80000000 or larger on 32-bit platforms (and similarly for 64-bit platforms). --- tests/test-coredump-unwind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-coredump-unwind.c b/tests/test-coredump-unwind.c index 5254708d..22fe9e42 100644 --- a/tests/test-coredump-unwind.c +++ b/tests/test-coredump-unwind.c @@ -314,7 +314,7 @@ main(int argc UNUSED, char **argv) while (*argv) { char *colon; - long vaddr = strtol(*argv, &colon, 16); + unsigned long vaddr = strtoul(*argv, &colon, 16); if (*colon != ':') error_msg_and_die("Bad format: '%s'", *argv); if (_UCD_add_backing_file_at_vaddr(ui, vaddr, colon + 1) < 0)