diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-05-08 19:34:40 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-05-08 19:34:40 +0000 |
commit | 51b9d4f26cd4169dd577d5bab8c77b31fad6dd5d (patch) | |
tree | 17d47e134509d2658a496d31764e4d82468a584a /libexec/telnetd/telnetd.c | |
parent | bdd13f2199e2288d8562f99dc8b1b7b5e80d22ae (diff) |
tighter buf handling
Diffstat (limited to 'libexec/telnetd/telnetd.c')
-rw-r--r-- | libexec/telnetd/telnetd.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c index 577e1a6727f..29ef75be734 100644 --- a/libexec/telnetd/telnetd.c +++ b/libexec/telnetd/telnetd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: telnetd.c,v 1.10 1998/04/25 04:43:03 millert Exp $ */ +/* $OpenBSD: telnetd.c,v 1.11 1998/05/08 19:34:39 deraadt Exp $ */ /* $NetBSD: telnetd.c,v 1.6 1996/03/20 04:25:57 tls Exp $ */ /* @@ -45,7 +45,7 @@ static char copyright[] = static char sccsid[] = "@(#)telnetd.c 8.4 (Berkeley) 5/30/95"; static char rcsid[] = "$NetBSD: telnetd.c,v 1.5 1996/02/28 20:38:23 thorpej Exp $"; #else -static char rcsid[] = "$OpenBSD: telnetd.c,v 1.10 1998/04/25 04:43:03 millert Exp $"; +static char rcsid[] = "$OpenBSD: telnetd.c,v 1.11 1998/05/08 19:34:39 deraadt Exp $"; #endif #endif /* not lint */ @@ -837,7 +837,8 @@ doit(who) fatal(net, "Out of ptys"); if ((pty = open(lp, 2)) >= 0) { - strcpy(line,lp); + strncpy(line, lp, sizeof line -1); + line[sizeof line -1] = '\0'; line[5] = 't'; break; } @@ -1156,8 +1157,10 @@ telnet(f, p, host) HE = getstr("he", &cp); HN = getstr("hn", &cp); IM = getstr("im", &cp); - if (HN && *HN) - (void) strcpy(host_name, HN); + if (HN && *HN) { + strcpy(host_name, HN, sizeof host_name - 1); + host_name[sizeof host_name -1] = '\0'; + } if (IM == 0) IM = ""; } else { |