From fb8e86e7d225bbf9f9c8dbb17f1a902250d0e632 Mon Sep 17 00:00:00 2001 From: Jakub Rzeszutko Date: Tue, 19 Nov 2024 08:54:10 +0100 Subject: [PATCH] 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 Signed-off-by: Jakub Rzeszutko (cherry picked from commit 1aaf08f7f12699a8a68c897a5cb3552a46d1f98c) --- subsys/shell/modules/devmem_service.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/shell/modules/devmem_service.c b/subsys/shell/modules/devmem_service.c index c2c37215d3a36c..7856ab8f862031 100644 --- a/subsys/shell/modules/devmem_service.c +++ b/subsys/shell/modules/devmem_service.c @@ -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;