nshlib:judge whether nsh login username is a valid input
Signed-off-by: huangjian <huangjian@xiaomi.com>
This commit is contained in:
parent
88fff23d34
commit
6aef469c19
@ -178,6 +178,12 @@ int nsh_login(FAR struct console_stdio_s *pstate)
|
||||
nsh_token(pstate, username, sizeof(username));
|
||||
}
|
||||
|
||||
if (username[0] == '\0')
|
||||
{
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NSH_PLATFORM_CHALLENGE
|
||||
platform_challenge(challenge, sizeof(challenge));
|
||||
fputs(challenge, pstate->cn_outstream);
|
||||
|
@ -187,6 +187,12 @@ int nsh_stdlogin(FAR struct console_stdio_s *pstate)
|
||||
nsh_stdtoken(pstate, username, sizeof(username));
|
||||
}
|
||||
|
||||
if (username[0] == '\0')
|
||||
{
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NSH_PLATFORM_CHALLENGE
|
||||
platform_challenge(challenge, sizeof(challenge));
|
||||
printf("%s", challenge);
|
||||
|
Loading…
Reference in New Issue
Block a user