[PATCH] common/command.c: Avoid NULL pointer use in cmd_auto_complete
Adam Lackorzynski
adam at l4re.org
Thu May 14 16:06:41 CEST 2026
Avoid putting a potential NULL pointer to strcmp, which would lead to a
load at address 0.
Signed-off-by: Adam Lackorzynski <adam at l4re.org>
---
common/command.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/command.c b/common/command.c
index 0f9dd06d72b..55bd9e44b1f 100644
--- a/common/command.c
+++ b/common/command.c
@@ -373,7 +373,7 @@ int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp)
const char *ps_prompt = CONFIG_SYS_PROMPT;
#endif
- if (strcmp(prompt, ps_prompt) != 0)
+ if (ps_prompt && strcmp(prompt, ps_prompt) != 0)
return 0; /* not in normal console */
cnt = strlen(buf);
--
2.53.0
More information about the U-Boot
mailing list