Browse Source

lib: shell: replace strtol with strtoul in cmd_load for address parsing

Addresses in cmd_load() should always be unsigned. Previously, strtol()
was used, which is limited to signed long values, causing issues with
addresses >= 0x80000000. This commit replaces strtol() with strtoul(),
ensuring proper handling of the full 32-bit address space.

Fixes #81343

Signed-off-by: Aaron Fontaine <aaron.fontaine@dojofive.com>
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@verkada.com>
pull/81698/head
Jakub Rzeszutko 8 months ago committed by Alberto Escolar
parent
commit
1aaf08f7f1
  1. 4
      subsys/shell/modules/devmem_service.c

4
subsys/shell/modules/devmem_service.c

@ -247,8 +247,8 @@ static int cmd_load(const struct shell *sh, size_t argc, char **argv) @@ -247,8 +247,8 @@ static int cmd_load(const struct shell *sh, size_t argc, char **argv)
argc--;
}
bytes = (unsigned char *)strtol(argv[1], NULL, 0);
data = (uint32_t *)strtol(argv[1], NULL, 0);
bytes = (unsigned char *)strtoul(argv[1], NULL, 0);
data = (uint32_t *)strtoul(argv[1], NULL, 0);
set_bypass(sh, bypass_cb);
return 0;

Loading…
Cancel
Save