diff --git a/lib/console.c b/lib/console.c index 7e2132dd..a847720a 100644 --- a/lib/console.c +++ b/lib/console.c @@ -13,6 +13,7 @@ #include #include "getdef.h" #include "prototypes.h" +#include "strlcpy.h" #ident "$Id$" @@ -44,7 +45,7 @@ static bool is_listed (const char *cfgin, const char *tty, bool def) if (*cons != '/') { char *pbuf; - strlcpy (buf, cons, sizeof (buf)); + STRLCPY(buf, cons); pbuf = &buf[0]; while ((s = strtok (pbuf, ":")) != NULL) { if (strcmp (s, tty) == 0) { diff --git a/lib/utmp.c b/lib/utmp.c index aa837ffb..9b173327 100644 --- a/lib/utmp.c +++ b/lib/utmp.c @@ -24,6 +24,7 @@ #include "alloc.h" #include "sizeof.h" +#include "strlcpy.h" #include "zustr2stp.h" #ident "$Id$" @@ -46,7 +47,7 @@ static bool is_my_tty (const char tty[UT_LINESIZE]) if ('\0' == tmptty[0]) { const char *tname = ttyname (STDIN_FILENO); if (NULL != tname) - (void) strlcpy (tmptty, tname, sizeof(tmptty)); + STRLCPY(tmptty, tname); } if ('\0' == tmptty[0]) { diff --git a/src/login.c b/src/login.c index 9faec818..93fd248c 100644 --- a/src/login.c +++ b/src/login.c @@ -711,8 +711,7 @@ int main (int argc, char **argv) sizeof (loginprompt), _("%s login: "), hostn); } else { - strlcpy (loginprompt, _("login: "), - sizeof (loginprompt)); + STRLCPY(loginprompt, _("login: ")); } retcode = pam_set_item (pamh, PAM_USER_PROMPT, loginprompt); diff --git a/src/su.c b/src/su.c index e3ede542..9c577f35 100644 --- a/src/su.c +++ b/src/su.c @@ -676,7 +676,7 @@ static /*@only@*/struct passwd * do_check_perms (void) SYSLOG ((LOG_INFO, "Change user from '%s' to '%s' as requested by PAM", name, tmp_name)); - if (strlcpy (name, tmp_name, sizeof(name)) >= sizeof(name)) { + if (STRLCPY(name, tmp_name) == -1) { fprintf (stderr, _("Overlong user name '%s'\n"), tmp_name); SYSLOG ((LOG_NOTICE, "Overlong user name '%s'",