Use strlcpy().

MFC after:	2 weeks
This commit is contained in:
Xin LI 2017-12-05 07:11:56 +00:00
parent 807e955710
commit aff7b6c709

View File

@ -277,9 +277,9 @@ main(int argc, char *argv[])
if (asme) {
if (pwd->pw_shell != NULL && *pwd->pw_shell != '\0') {
/* must copy - pwd memory is recycled */
shell = strncpy(shellbuf, pwd->pw_shell,
strlcpy(shellbuf, pwd->pw_shell,
sizeof(shellbuf));
shellbuf[sizeof(shellbuf) - 1] = '\0';
shell = shellbuf;
}
else {
shell = _PATH_BSHELL;