diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2014-10-17 20:16:14 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2014-10-17 20:16:14 +0000 |
commit | 7c4e118f27eb3f30572853fc159f78a3fa66b34d (patch) | |
tree | 9d7a135f9d1f97801a068f1e6429fe21aaed294e /usr.bin/finger | |
parent | fd203e6f78619f4d6702a6f56356450ed4f5075f (diff) |
Use strlcpy() instead of strncpy() when making a copy of pw_gecos.
Diffstat (limited to 'usr.bin/finger')
-rw-r--r-- | usr.bin/finger/util.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/finger/util.c b/usr.bin/finger/util.c index de2053ee863..9cf730edde2 100644 --- a/usr.bin/finger/util.c +++ b/usr.bin/finger/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.25 2014/10/17 08:03:04 doug Exp $ */ +/* $OpenBSD: util.c,v 1.26 2014/10/17 20:16:13 millert Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. @@ -115,7 +115,7 @@ userinfo(PERSON *pn, struct passwd *pw) pn->dir = estrdup(pw->pw_dir); pn->shell = estrdup(pw->pw_shell); - (void)strncpy(bp = tbuf, pw->pw_gecos, sizeof(tbuf)); + (void)strlcpy(bp = tbuf, pw->pw_gecos, sizeof(tbuf)); /* ampersands get replaced by the login name */ if (!(p = strsep(&bp, ","))) @@ -148,7 +148,7 @@ match(struct passwd *pw, char *user) char *p, *t; char name[1024]; - (void)strncpy(p = tbuf, pw->pw_gecos, sizeof(tbuf)); + (void)strlcpy(p = tbuf, pw->pw_gecos, sizeof(tbuf)); /* ampersands get replaced by the login name */ if (!(p = strtok(p, ","))) |