diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/nshlib/nsh_telnetd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/nshlib/nsh_telnetd.c b/apps/nshlib/nsh_telnetd.c index b3e67b87c..9e712cc7b 100644 --- a/apps/nshlib/nsh_telnetd.c +++ b/apps/nshlib/nsh_telnetd.c @@ -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) |