Avoid putting a potential NULL pointer to strcmp, which would lead to a
load at address 0.

Signed-off-by: Adam Lackorzynski <[email protected]>
---
 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

Reply via email to