diff options
-rw-r--r-- | usr.bin/finger/net.c | 8 | ||||
-rw-r--r-- | usr.bin/sed/main.c | 8 | ||||
-rw-r--r-- | usr.bin/w/pr_time.c | 10 | ||||
-rw-r--r-- | usr.bin/write/write.c | 16 |
4 files changed, 21 insertions, 21 deletions
diff --git a/usr.bin/finger/net.c b/usr.bin/finger/net.c index 1329c2e309c..d4cdddb61f4 100644 --- a/usr.bin/finger/net.c +++ b/usr.bin/finger/net.c @@ -1,4 +1,4 @@ -/* $OpenBSD: net.c,v 1.7 1999/12/11 10:05:04 itojun Exp $ */ +/* $OpenBSD: net.c,v 1.8 2003/03/13 15:47:10 deraadt Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. @@ -38,7 +38,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)net.c 5.5 (Berkeley) 6/1/90";*/ -static char rcsid[] = "$OpenBSD: net.c,v 1.7 1999/12/11 10:05:04 itojun Exp $"; +static char rcsid[] = "$OpenBSD: net.c,v 1.8 2003/03/13 15:47:10 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -102,8 +102,8 @@ netfinger(name) /* have network connection; identify the host connected with */ if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, sizeof(hbuf), - NULL, 0, NI_NUMERICHOST) != 0) { - strcpy(hbuf, "(invalid)"); + NULL, 0, NI_NUMERICHOST) != 0) { + strlcpy(hbuf, "(invalid)", sizeof hbuf); } (void)printf("[%s/%s]\n", host, hbuf); diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c index 505f20cebe4..ffc7b769f29 100644 --- a/usr.bin/sed/main.c +++ b/usr.bin/sed/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.6 2002/02/16 21:27:52 millert Exp $ */ +/* $OpenBSD: main.c,v 1.7 2003/03/13 15:47:11 deraadt Exp $ */ /*- * Copyright (c) 1992 Diomidis Spinellis. @@ -45,7 +45,7 @@ static char copyright[] = #ifndef lint /* from: static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/3/94"; */ -static char *rcsid = "$OpenBSD: main.c,v 1.6 2002/02/16 21:27:52 millert Exp $"; +static char *rcsid = "$OpenBSD: main.c,v 1.7 2003/03/13 15:47:11 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -192,8 +192,8 @@ again: if ((snprintf(string_ident, sizeof(string_ident), "\"%s\"", script->s)) >= sizeof(string_ident)) - (void)strcpy(string_ident + - sizeof(string_ident) - 6, " ...\""); + strlcpy(string_ident + + sizeof(string_ident) - 6, " ...\"", 5); fname = string_ident; s = script->s; state = ST_STRING; diff --git a/usr.bin/w/pr_time.c b/usr.bin/w/pr_time.c index 10caa4ed721..4a0bd50db74 100644 --- a/usr.bin/w/pr_time.c +++ b/usr.bin/w/pr_time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pr_time.c,v 1.9 1998/01/16 17:50:42 millert Exp $ */ +/* $OpenBSD: pr_time.c,v 1.10 2003/03/13 15:47:12 deraadt Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)pr_time.c 8.2 (Berkeley) 4/4/94"; #else -static char *rcsid = "$OpenBSD: pr_time.c,v 1.9 1998/01/16 17:50:42 millert Exp $"; +static char *rcsid = "$OpenBSD: pr_time.c,v 1.10 2003/03/13 15:47:12 deraadt Exp $"; #endif #endif /* not lint */ @@ -73,16 +73,16 @@ pr_attime(started, now) /* If more than a week, use day-month-year. */ if (diff > SECSPERDAY * DAYSPERWEEK) - (void)strcpy(fmt, "%d%b%y"); + (void)strlcpy(fmt, "%d%b%y", sizeof fmt); /* If not today, use day-hour-am/pm. */ else if (tp->tm_yday != today ) { - (void)strcpy(fmt, __CONCAT("%a%", "I%p")); + (void)strlcpy(fmt, __CONCAT("%a%", "I%p"), sizeof fmt); } /* Default is hh:mm{am,pm}. */ else { - (void)strcpy(fmt, __CONCAT("%l:%", "M%p")); + (void)strlcpy(fmt, __CONCAT("%l:%", "M%p"), sizeof fmt); } (void)strftime(buf, sizeof(buf) -1, fmt, tp); diff --git a/usr.bin/write/write.c b/usr.bin/write/write.c index 52707f44f98..d086ce6550a 100644 --- a/usr.bin/write/write.c +++ b/usr.bin/write/write.c @@ -1,4 +1,4 @@ -/* $OpenBSD: write.c,v 1.18 2002/12/09 08:15:29 deraadt Exp $ */ +/* $OpenBSD: write.c,v 1.19 2003/03/13 15:47:12 deraadt Exp $ */ /* $NetBSD: write.c,v 1.5 1995/08/31 21:48:32 jtc Exp $ */ /* @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)write.c 8.2 (Berkeley) 4/27/95"; #endif -static char *rcsid = "$OpenBSD: write.c,v 1.18 2002/12/09 08:15:29 deraadt Exp $"; +static char *rcsid = "$OpenBSD: write.c,v 1.19 2003/03/13 15:47:12 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -68,7 +68,7 @@ static char *rcsid = "$OpenBSD: write.c,v 1.18 2002/12/09 08:15:29 deraadt Exp $ void done(int sig); void do_write(char *, char *, uid_t); void wr_fputs(char *); -void search_utmp(char *, char *, char *, uid_t); +void search_utmp(char *, char *, int, char *, uid_t); int term_chk(char *, int *, time_t *, int); int utmp_chk(char *, char *); @@ -103,7 +103,7 @@ main(int argc, char **argv) /* check args */ switch (argc) { case 2: - search_utmp(argv[1], tty, mytty, myuid); + search_utmp(argv[1], tty, sizeof tty, mytty, myuid); do_write(tty, mytty, myuid); break; case 3: @@ -165,7 +165,7 @@ utmp_chk(char *user, char *tty) * writing from, unless that's the only terminal with messages enabled. */ void -search_utmp(char *user, char *tty, char *mytty, uid_t myuid) +search_utmp(char *user, char *tty, int ttyl, char *mytty, uid_t myuid) { struct utmp u; time_t bestatime, atime; @@ -194,7 +194,7 @@ search_utmp(char *user, char *tty, char *mytty, uid_t myuid) ++nttys; if (atime > bestatime) { bestatime = atime; - (void)strcpy(tty, atty); + (void)strlcpy(tty, atty, ttyl); } } @@ -203,7 +203,7 @@ search_utmp(char *user, char *tty, char *mytty, uid_t myuid) errx(1, "%s is not logged in", user); if (nttys == 0) { if (user_is_me) { /* ok, so write to yourself! */ - (void)strcpy(tty, mytty); + (void)strlcpy(tty, mytty, ttyl); return; } errx(1, "%s has messages disabled", user); @@ -265,7 +265,7 @@ do_write(char *tty, char *mytty, uid_t myuid) /* print greeting */ if (gethostname(host, sizeof(host)) < 0) - (void)strcpy(host, "???"); + (void)strlcpy(host, "???", sizeof host); now = time((time_t *)NULL); nows = ctime(&now); nows[16] = '\0'; |