Skip to content

Commit bd1db48

Browse files
jakub-uCdkalowsk
authored andcommitted
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 <[email protected]> Signed-off-by: Jakub Rzeszutko <[email protected]> (cherry picked from commit 1aaf08f)
1 parent 8ac7bde commit bd1db48

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

subsys/shell/modules/devmem_service.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ static int cmd_load(const struct shell *sh, size_t argc, char **argv)
247247
argc--;
248248
}
249249

250-
bytes = (unsigned char *)strtol(argv[1], NULL, 0);
251-
data = (uint32_t *)strtol(argv[1], NULL, 0);
250+
bytes = (unsigned char *)strtoul(argv[1], NULL, 0);
251+
data = (uint32_t *)strtoul(argv[1], NULL, 0);
252252

253253
set_bypass(sh, bypass_cb);
254254
return 0;

0 commit comments

Comments
 (0)