1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-12-23 03:53:43 +01:00

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).
This commit is contained in:
Petr Malat 2016-12-15 14:48:33 +01:00 committed by Dave Watson
parent 4b63a536ee
commit b707e13ca0

View file

@ -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)