For Telnetd password/username fixes from Bertikd Van den Bergh

This commit is contained in:
Gregory Nutt 2014-02-22 11:55:30 -06:00
parent f1628d5055
commit 89526241af

View File

@ -132,7 +132,7 @@ int nsh_telnetlogin(struct console_stdio_s *pstate)
if (fgets(pstate->cn_line, CONFIG_NSH_LINELEN, INSTREAM(pstate)) != NULL)
{
strncpy(username, pstate->cn_line, sizeof(username));
username[strlen(pstate->cn_line) - 1] = 0;
username[sizeof(username) - 1] = 0;
}
/* Ask for the login password */
@ -145,7 +145,7 @@ int nsh_telnetlogin(struct console_stdio_s *pstate)
/* Verify the username and password */
strncpy(password, pstate->cn_line, sizeof(password));
password[strlen(pstate->cn_line) - 1] = 0;
password[sizeof(password) - 1] = 0;
if (strcmp(password, CONFIG_NSH_TELNET_PASSWORD) == 0 &&
strcmp(username, CONFIG_NSH_TELNET_USERNAME) == 0)