From owner-doc-jp@jp.freebsd.org  Wed Nov 22 01:44:10 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id BAA45927;
	Wed, 22 Nov 2000 01:44:10 +0900 (JST)
	(envelope-from owner-doc-jp@jp.FreeBSD.org)
Received: from eos.ocn.ne.jp (eos.ocn.ne.jp [210.190.142.171])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id BAA45922
	for <doc-jp@jp.freebsd.org>; Wed, 22 Nov 2000 01:44:10 +0900 (JST)
	(envelope-from hrs@eos.ocn.ne.jp)
Received: from mail.hrslab.yi.org (p0189-ip01funabasi.chiba.ocn.ne.jp [211.123.225.189])
	by eos.ocn.ne.jp (8.9.1a/OCN/) with ESMTP id BAA25535
	for <doc-jp@jp.freebsd.org>; Wed, 22 Nov 2000 01:44:06 +0900 (JST)
Message-Id: <200011211644.BAA25535@eos.ocn.ne.jp>
Received: from localhost (alph.hrslab.yi.org [192.168.0.10])
	by mail.hrslab.yi.org (8.9.3/3.7W/DomainMaster) with ESMTP id BAA56412
	for <doc-jp@jp.freebsd.org>; Wed, 22 Nov 2000 01:35:49 +0900 (JST)
	(envelope-from hrs@eos.ocn.ne.jp)
To: doc-jp@jp.freebsd.org
In-Reply-To: <20001120213645.7285337B4C5@hub.freebsd.org>
References: <20001120213645.7285337B4C5@hub.freebsd.org>
X-Mailer: Mew version 1.94.1 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA)
Mime-Version: 1.0
Content-Type: Multipart/Mixed;
 boundary="--Next_Part(Wed_Nov_22_01:35:30_2000_41)--"
Content-Transfer-Encoding: 7bit
Date: Wed, 22 Nov 2000 01:35:48 +0900
From: Hiroki Sato <hrs@eos.ocn.ne.jp>
X-Dispatcher: imput version 20000228(IM140)
Lines: 411
Reply-To: doc-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+000315
X-Sequence: doc-jp 7852
Subject: [doc-jp 7852] Re: ANNOUNCE: FreeBSD Security Advisory: FreeBSD-SA-00:69.telnetd
 [REVISED]
Errors-To: owner-doc-jp@jp.freebsd.org
Sender: owner-doc-jp@jp.freebsd.org
X-Originator: hrs@eos.ocn.ne.jp

----Next_Part(Wed_Nov_22_01:35:30_2000_41)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

$B:4F#!wEl5~M}2JBg3X$G$9!#(B

 00:69 $B$N(B revised $B$G$9!#(B

Index: 00:69
===================================================================
RCS file: /home/cvs/private/hrs/FreeBSD-SA/00:69,v
retrieving revision 1.1
retrieving revision 1.2
diff -d -u -I\$FreeBSD:.*\$ -I\$Id:.*\$ -I\$hrs:.*\$ -b -r1.1 -r1.2
--- 00:69	2000/11/19 20:27:34	1.1
+++ 00:69	2000/11/21 16:23:13	1.2
@@ -41,19 +41,27 @@
 FreeBSD-SA-00:69                                           Security Advisory
                                                                 FreeBSD, Inc.
 
-$B%H%T%C%/(B:	telnetd allows remote system resource consumption.
+$B%H%T%C%/(B:       telnetd allows remote system resource consumption [REVISED]
 
 $BJ,N`(B:		core
 $B%b%8%e!<%k(B:	telnetd
 $B9pCNF|(B:		2000-11-14
+$B2~D{F|(B:         2000-11-20
 $B%/%l%8%C%H(B:	Jouko Pynnonen <jouko@SOLUTIONS.FI>
 $B1F6AHO0O(B:	FreeBSD 3.x ($B$9$Y$F$N%j%j!<%9(B),
                 FreeBSD 4.x (4.2 $B0JA0$N$9$Y$F$N%j%j!<%9(B),
                 $B=$@5F|0JA0$N(B FreeBSD 3.5.1-STABLE $B$*$h$S(B 4.1.1-STABLE
-$B=$@5F|(B:		2000-10-30 (FreeBSD 4.1.1-STABLE)
-                2000-11-01 (FreeBSD 3.5.1-STABLE)
+$B=$@5F|(B:         2000-11-19 (FreeBSD 4.1.1-STABLE)
+                2000-11-19 (FreeBSD 3.5.1-STABLE)
 FreeBSD $B$K8GM-$+(B:	NO
 
+0.   $B2~D{MzNr(B
+
+v1.0  2000-11-14  $B=iHG8x3+(B
+v1.1  2000-11-20  $B=$@5%Q%C%A$N2~D{(B.
+                  Christos Zoulas <christos@ZOULAS.COM> $B$N;XE&$K$h$k(B.
+
+
 I.   $BGX7J(B - Background
 
 telnetd is the server for the telnet remote login protocol.
@@ -160,9 +168,13 @@
 $B<!$N$$$:$l$+$K=>$C$F$/$@$5$$(B.
 
 1) Upgrade your vulnerable FreeBSD system to 4.1.1-STABLE or
-3.5.1-STABLE after the respective correction dates.
+3.5.1-STABLE after the respective correction dates.  Note that the
+original patch was incorrect and caused telnetd to behave incorrectly
+in certain situations. 
 1) $B<eE@$r;}$C$?(B FreeBSD $B%7%9%F%`$r(B, $B=$@5F|0J9_$N(B
    4.1.1-STABLE $B$b$7$/$O(B 3.5.1-STABLE $B$K%"%C%W%0%l!<%I$7$^$9(B.
+   $B=iHG$N4+9p$GG[I[$5$l$F$$$?=$@5%Q%C%A$OIT40A4$G(B, $BFCDj$N>u672<$G(B
+   telnetd $B$,F0:nITNI$r0z$-5/$3$7$^$9(B.  $B$4Cm0U$/$@$5$$(B.
 
 2) Apply the patch below and recompile the relevant files:
 2) $B2<$N=$@5%Q%C%A$rE,MQ$7(B, $B4XO"%U%!%$%k$r:F9=C[$7$^$9(B.
@@ -173,8 +185,8 @@
 $B$3$N4+9p$r%U%!%$%k$KJ]B8$9$k$+(B, $B=$@5%Q%C%A$H(B PGP $B=pL>$r0J2<$N>l=j$+$i(B
 $B%@%&%s%m!<%I$7(B, PGP $B%f!<%F%#%j%F%#$r;H$C$F=pL>$r3NG'$7$^$9(B.
 
-ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-00:69/telnetd.patch
-ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-00:69/telnetd.patch.asc
+ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-00:69/telnetd.patch.v1.1
+ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-00:69/telnetd.patch.v1.1.asc
 
 Execute the following commands as root:
 $B$=$7$F(B root $B8"8B$G<!$N%3%^%s%I$r<B9T$7$^$9(B.
@@ -183,18 +195,53 @@
 # patch -p < /path/to/patch_or_advisory
 # make depend && make all install
 
-Patch for vulnerable systems:
-$B<eE@$r;}$C$?%7%9%F%`MQ$N=$@5%Q%C%A(B:
+Updated patch for vulnerable systems:
+$B<eE@$r;}$C$?%7%9%F%`MQ$N=$@5%Q%C%A(B($B2~D{HG(B):

--
| $B:4F#(B $B9-@8!wEl5~M}2JBg3X(B <hrs@eos.ocn.ne.jp>
|
| sato@sekine00.ee.noda.sut.ac.jp (UNIV)
| hrs@FreeBSD.org (FreeBSD Project)

----Next_Part(Wed_Nov_22_01:35:30_2000_41)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Disposition: attachment; filename="00:69"
Content-Transfer-Encoding: 7bit

 $B$3$N%a!<%k$O(B, announce-jp $B$KN.$l$?(B

  Subject: ANNOUNCE: FreeBSD Security Advisory: FreeBSD-SA-00:69.telnetd [REVISED]
  From: FreeBSD Security Advisories <security-advisories@freebsd.org>
  Date: Mon, 20 Nov 2000 13:36:45 -0800 (PST)
  Message-Id: <20001120213645.7285337B4C5@hub.freebsd.org>
  X-Sequence: announce-jp 605

 $B$rF|K\8lLu$7$?$b$N$G$9(B. 

 $B$3$N4+9p$NCf$G>R2p$5$l$F$$$k(B WWW $B%5%$%H(B http://www.FreeBSD.org/ $B$*$h$S(B
 FTP $B%5%$%H(B ftp://ftp.FreeBSD.org/ $B$K$O(B, $BF|K\$N%_%i!<%5%$%H$,B8:_$7$^$9(B.
 $B%_%i!<%5%$%H$rMxMQ$9$k$K$O(B,
 http://www.FreeBSD.org/ $B$r(B http://www.jp.FreeBSD.org/www.freebsd.org/ $B$K(B,
 ftp://ftp.FreeBSD.org/ $B$r(B ftp://ftp.jp.FreeBSD.org/ $B$K(B,
 $B$=$l$>$lCV$-49$($F$/$@$5$$(B.

 $B%M%C%H%o!<%/$N:.;($r4KOB$9$k$?$a(B, $B$^$:$O%_%i!<%5%$%H$NMxMQ$r(B
 $B9MN8$9$k$h$&$*4j$$$7$^$9(B.  $B%_%i!<%5%$%H$K4X$9$k>\:Y$O(B

  http://www.FreeBSD.org/handbook/mirror.html ($B1QJ8(B)
  http://www.FreeBSD.org/ja/handbook/mirror.html ($BF|K\8lLu(B)

 $B$K(B, $B$^$?(B, $B2a5n$NF|K\8lHG%;%-%e%j%F%#4+9p$O(B

  http://www.FreeBSD.org/ja/security/

 $B$K$^$H$a$i$l$F$$$^$9(B.

 $B86J8$O(B PGP $B=pL>$5$l$F$$$^$9$,(B, $B$3$NF|K\8lLu$O(B PGP $B=pL>$5$l$F$$$^$;$s(B. 
 $B%Q%C%AEy$NFbMF$,2~cb$5$l$F$$$J$$$3$H$r3NG'$9$k$?$a$K(B PGP $B$N%A%'%C%/$r(B
 $B9T$J$&$K$O(B, $B86J8$r;2>H$7$F$/$@$5$$(B. 

 $BF|K\8lLu$O(B FreeBSD $BF|K\8l%I%-%e%a%s%F!<%7%g%s%W%m%8%'%/%H(B (doc-jp) $B$,;29M$N(B
 $B$?$a$KDs6!$9$k$b$N$G(B, doc-jp $B$O(B $B$=$NFbMF$K$D$$$F$$$+$J$kJ]>Z$b$$$?$7$^$;$s(B.
 $BF|K\8lLu$K$D$$$F$N$*Ld$$9g$o$;$O(B doc-jp@jp.FreeBSD.org $B$^$G$*4j$$$7$^$9(B.

--($B$3$3$+$i(B)

=============================================================================
FreeBSD-SA-00:69                                           Security Advisory
                                                                FreeBSD, Inc.

$B%H%T%C%/(B:       telnetd allows remote system resource consumption [REVISED]

$BJ,N`(B:           core
$B%b%8%e!<%k(B:     telnetd
$B9pCNF|(B:         2000-11-14
$B2~D{F|(B:         2000-11-20
$B%/%l%8%C%H(B:     Jouko Pynnonen <jouko@SOLUTIONS.FI>
$B1F6AHO0O(B:       FreeBSD 3.x ($B$9$Y$F$N%j%j!<%9(B),
                FreeBSD 4.x (4.2 $B0JA0$N$9$Y$F$N%j%j!<%9(B),
                $B=$@5F|0JA0$N(B FreeBSD 3.5.1-STABLE $B$*$h$S(B 4.1.1-STABLE
$B=$@5F|(B:         2000-11-19 (FreeBSD 4.1.1-STABLE)
                2000-11-19 (FreeBSD 3.5.1-STABLE)
FreeBSD $B$K8GM-$+(B:       NO

0.   $B2~D{MzNr(B

v1.0  2000-11-14  $B=iHG8x3+(B
v1.1  2000-11-20  $B=$@5%Q%C%A$N2~D{(B.
                  Christos Zoulas <christos@ZOULAS.COM> $B$N;XE&$K$h$k(B.


I.   $BGX7J(B - Background

telnetd is the server for the telnet remote login protocol.

telnetd $B$O(B telnet $B%j%b!<%H%m%0%$%s%W%m%H%3%k$N%5!<%P$G$9(B.

II.  $BLdBj$N>\:Y(B - Problem Description

The telnet protocol allows for UNIX environment variables to be passed
from the client to the user login session on the server.  However, some
of these environment variables have special meaning to the telnetd
child process itself and may be used to affect its operation.

telnet $B%W%m%H%3%k$O(B, $B%/%i%$%"%s%H$+$i%5!<%P>e$N%f!<%6%m%0%$%s%;%7%g%s$K(B
UNIX $B4D6-JQ?t$rEO$95!G=$r;}$C$F$$$^$9(B.  $B$7$+$7(B, $B$=$N4D6-JQ?t$NCf$K$O(B
$BFCJL$J0UL#$r;}$A(B, telnetd $B;R%W%m%;%9<+?H$NF0:n$K1F6A$rM?$($k$?$a$K(B
$B;H$o$l$k$b$N$,$"$j$^$9(B.

Of particular relevance is the ability for remote users to cause an
arbitrary file on the system to be searched for termcap data by
passing the TERMCAP environment variable.  Although any file on the
local system can be read since the telnetd server runs as root, the
contents of the file will not be reported in any way to the remote
user unless it contains a valid termcap entry, in which case the
corresponding termcap sequences will be used to format the output sent
to the client.  It is believed there is no risk of data disclosure
through this vulnerability.

$BFC$KLdBj$H$J$k$N$O(B, $B%j%b!<%H%f!<%6$,(B TERMCAP $B4D6-JQ?t$rEO$7$F(B,
$B$=$N%7%9%F%`>e$NG$0U$N%U%!%$%k$r(B termcap $B%G!<%?$H$7$F8!:w$5$;$k(B
$B$3$H$,$G$-$k$H$$$&E@$G$9(B.  telnetd $B%5!<%P%W%m%0%i%`$O(B root $B8"8B$G(B
$BF0:n$9$k$?$a%m!<%+%k%7%9%F%`>e$NG$0U$N%U%!%$%k$rFI$`$3$H$,$G$-$^$9$,(B, 
$B%U%!%$%k$NFbMF$,M-8z$J(B termcap $B%(%s%H%j$G$"$k8B$j(B, $B$=$NFbMF$,(B
$B8+$($k7A$G8=$o$l$k$3$H$O0l@Z$J$/(B, $B$^$?(B, $B$=$NFbMF$KBP1~$9$k(B termcap
$B@)8fJ8;zNs$O(B, $B%/%i%$%"%s%H$KAw$i$l$k=PNO$N=q<0;XDj$KMxMQ$5$l$^$9(B.
$B$3$N$?$a(B, $B$3$N%;%-%e%j%F%#>e$N<eE@$K$h$k%G!<%?$NO31L$N4m81@-$O$J$$$H(B
$B9M$($i$l$F$$$^$9(B.

However, an attacker who forces the server to search through a large
file or to read from a device can cause resources to be spent by the
server, including CPU cycles and disk read bandwidth, which can
increase the server load and may prevent it from servicing legitimate
user requests.  Since the vulnerability occurs before the login(1)
utility is spawned, it does not require authentication to a valid
account on the server in order to exploit.

$B$7$+$7967b<T$O(B, $B%5!<%P$KBP$7$FBg$-$$%U%!%$%k$r8!:w$5$;$?$j(B,
$B%G%P%$%9%U%!%$%k$NFI$_$@$7$r9T$J$o$;$k$3$H$G(B, $B%5!<%P$N(B CPU $B;~4V$d(B
$B%G%#%9%/FI$_$@$7BS0hI}$J$I$N%5!<%P$N;q8;$rL5BL$K>CHq$5$;$k$3$H$,$G$-$^$9(B.
$B$3$l$O%5!<%P$NIi2Y$rA}2C$5$;(B, $BK\Mh$N@5Ev$J%f!<%6$NMW5a$X$N%5!<%S%9$r(B
$BK832$G$-$k$H$$$&$3$H$r0UL#$7$^$9(B.  $B$3$N%;%-%e%j%F%#>e$N<eE@$O(B
login(1) $B%f!<%F%#%j%F%#$,8F$S=P$5$l$kA0$KH/@8$9$k$?$a(B, $B0-MQ$9$k$N$K(B
$B%5!<%P>e$GM-8z$J%"%+%&%s%HG'>Z$rI,MW$H$7$^$;$s(B.

All released versions of FreeBSD prior to the correction date
including 4.0, 4.1, 4.1.1 and 3.5.1 are vulnerable to this problem,
but it was fixed in the 4.1.1-STABLE branch prior to the release of
FreeBSD 4.2-RELEASE.

FreeBSD 4.0, 4.1, 4.1.1 $B$*$h$S(B 3.5.1 $B$r4^$`(B, $B=$@5F|0JA0$N$9$Y$F$N(B
FreeBSD $B%j%j!<%9$,$3$NLdBj$N1F6A$r<u$1$^$9(B.
$BLdBjE@$N=$@5$O(B FreeBSD 4.2-RELEASE $B$N8x3+A0$N(B 4.1.1-STABLE $B%V%i%s%A$G(B
$B9T$J$o$l$^$7$?(B.


III. $B1F6AHO0O(B - Impact

Remote users without a valid login account on the server can cause
resources such as CPU and disk read bandwidth to be consumed, causing
increased server load and possibly denying service to legitimate
users.

$B%j%b!<%H%f!<%6$O(B, $B%5!<%P>e$KM-8z$J%m%0%$%s%"%+%&%s%H$,$J$/$H$b(B,
$B%5!<%P>e$N(B CPU $B$d%G%#%9%/FI$_$@$7BS0hI}$J$I$N;q8;$r>CHq$5$;$k$3$H$,(B
$B2DG=$G$9(B.  $B$3$l$O%5!<%P$NIi2Y$rA}2C$5$;$k$@$1$G$J$/(B, $BK\Mh$N@5Ev$J(B
$B%f!<%6$KBP$9$k%5!<%S%9$rK832$G$-$k2DG=@-$,$"$j$^$9(B.

IV.  $B2sHrJ}K!(B - Workaround

1) Disable the telnet service, which is usually run out of inetd:
comment out the following lines in /etc/inetd.conf, if present.
1) telnet $B%5!<%S%9$rDd;_$5$;$^$9(B.  $B$3$N%5!<%S%9$ODL>o(B, inetd $B$K(B
   $B$h$C$F5/F0$5$l$^$9(B.  /etc/inetd.conf $B$K0J2<$N9T$,B8:_$9$k>l9g$O(B,
   $B$=$l$i$r%3%a%s%H%"%&%H$7$F$/$@$5$$(B.

telnet  stream  tcp     nowait  root    /usr/libexec/telnetd    telnetd

telnet  stream  tcp6    nowait  root    /usr/libexec/telnetd    telnetd

2) Impose access restrictions using TCP wrappers (/etc/hosts.allow),
or a network-level packet filter such as ipfw(8) or ipf(8) on the
perimeter firewall or the local machine, to limit access to the telnet
service to trusted machines.

2) TCP wrappers (/etc/hosts.allow) $B$+(B, ipfw(8) $B$d(B ipf(8) $B$H$$$C$?(B,
   $B%M%C%H%o!<%/%l%Y%k$N%Q%1%C%H%U%#%k%?$r(B, $B%U%!%$%"%&%)!<%k(B, $B$b$7$/$O(B
   $B%m!<%+%k%^%7%s$GMQ$$$F%"%/%;%9@)8B$rL@<(E*$K9T$J$$(B, telnet $B%5!<%S%9$r(B
   $B?.Mj$G$-$k%^%7%s$N$_$K@)8B$7$^$9(B.


V.   $B2r7h:v(B - Solution

One of the following:
$B<!$N$$$:$l$+$K=>$C$F$/$@$5$$(B.

1) Upgrade your vulnerable FreeBSD system to 4.1.1-STABLE or
3.5.1-STABLE after the respective correction dates.  Note that the
original patch was incorrect and caused telnetd to behave incorrectly
in certain situations. 
1) $B<eE@$r;}$C$?(B FreeBSD $B%7%9%F%`$r(B, $B=$@5F|0J9_$N(B
   4.1.1-STABLE $B$b$7$/$O(B 3.5.1-STABLE $B$K%"%C%W%0%l!<%I$7$^$9(B.
   $B=iHG$N4+9p$GG[I[$5$l$F$$$?=$@5%Q%C%A$OIT40A4$G(B, $BFCDj$N>u672<$G(B
   telnetd $B$,F0:nITNI$r0z$-5/$3$7$^$9(B.  $B$4Cm0U$/$@$5$$(B.

2) Apply the patch below and recompile the relevant files:
2) $B2<$N=$@5%Q%C%A$rE,MQ$7(B, $B4XO"%U%!%$%k$r:F9=C[$7$^$9(B.

Either save this advisory to a file, or download the patch and
detached PGP signature from the following locations, and verify the
signature using your PGP utility.
$B$3$N4+9p$r%U%!%$%k$KJ]B8$9$k$+(B, $B=$@5%Q%C%A$H(B PGP $B=pL>$r0J2<$N>l=j$+$i(B
$B%@%&%s%m!<%I$7(B, PGP $B%f!<%F%#%j%F%#$r;H$C$F=pL>$r3NG'$7$^$9(B.

ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-00:69/telnetd.patch.v1.1
ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-00:69/telnetd.patch.v1.1.asc

Execute the following commands as root:
$B$=$7$F(B root $B8"8B$G<!$N%3%^%s%I$r<B9T$7$^$9(B.

# cd /usr/src/libexec/telnetd
# patch -p < /path/to/patch_or_advisory
# make depend && make all install

Updated patch for vulnerable systems:
$B<eE@$r;}$C$?%7%9%F%`MQ$N=$@5%Q%C%A(B($B2~D{HG(B):

    Index: ext.h
    ===================================================================
    RCS file: /home/ncvs/src/libexec/telnetd/ext.h,v
    retrieving revision 1.7
    retrieving revision 1.8
    diff -u -r1.7 -r1.8
    --- ext.h   1999/08/28 00:10:22     1.7
    +++ ext.h   2000/11/19 10:01:27     1.8
    @@ -87,7 +87,7 @@
     #endif
     
     extern int pty, net;
    -extern char        *line;
    +extern char        line[16];
     extern int SYNCHing;               /* we are in TELNET SYNCH mode */
     
     #ifndef    P
    Index: sys_term.c
    ===================================================================
    RCS file: /home/ncvs/src/libexec/telnetd/sys_term.c,v
    retrieving revision 1.24
    retrieving revision 1.26
    diff -u -r1.24 -r1.26
    --- sys_term.c      1999/08/28 00:10:24     1.24
    +++ sys_term.c      2000/11/19 10:01:27     1.26
    @@ -480,14 +480,10 @@
      *
      * Returns the file descriptor of the opened pty.
      */
    -#ifndef    __GNUC__
    -char *line = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
    -#else
    -static char Xline[] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
    -char *line = Xline;
    -#endif
     #ifdef     CRAY
    -char *myline = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
    +char myline[16];
    +#else
    +char line[16];
     #endif     /* CRAY */
     
        int
    @@ -1799,6 +1795,13 @@
                    strncmp(*cpp, "_RLD_", 5) &&
                    strncmp(*cpp, "LIBPATH=", 8) &&
     #endif
    +               strncmp(*cpp, "LOCALDOMAIN=", 12) &&
    +               strncmp(*cpp, "RES_OPTIONS=", 12) &&
    +               strncmp(*cpp, "TERMINFO=", 9) &&
    +               strncmp(*cpp, "TERMINFO_DIRS=", 14) &&
    +               strncmp(*cpp, "TERMPATH=", 9) &&
    +               strncmp(*cpp, "TERMCAP=/", 9) &&
    +               strncmp(*cpp, "ENV=", 4) &&
                    strncmp(*cpp, "IFS=", 4))
                        *cpp2++ = *cpp;
        }
    Index: telnetd.c
    ===================================================================
    RCS file: /home/ncvs/src/libexec/telnetd/telnetd.c,v
    retrieving revision 1.22
    retrieving revision 1.24
    diff -u -r1.22 -r1.24
    --- telnetd.c       2000/01/25 14:52:00     1.22
    +++ telnetd.c       2000/11/19 10:01:27     1.24
    @@ -805,13 +805,12 @@
     #else
        for (;;) {
                char *lp;
    -           extern char *line, *getpty();
     
                if ((lp = getpty()) == NULL)
                        fatal(net, "Out of ptys");
     
                if ((pty = open(lp, 2)) >= 0) {
    -                   strcpy(line,lp);
    +                   strlcpy(line,lp,sizeof(line));
                        line[5] = 't';
                        break;
                }
    @@ -1115,7 +1114,7 @@
                IM = Getstr("im", &cp);
                IF = Getstr("if", &cp);
                if (HN && *HN)
    -                   (void) strcpy(host_name, HN);
    +                   (void) strlcpy(host_name, HN, sizeof(host_name));
                if (IF && (if_fd = open(IF, O_RDONLY, 000)) != -1)
                        IM = 0;
                if (IM == 0)
    Index: utility.c
    ===================================================================
    RCS file: /home/ncvs/src/libexec/telnetd/utility.c,v
    retrieving revision 1.13
    retrieving revision 1.14
    diff -u -r1.13 -r1.14
    --- utility.c       1999/08/28 00:10:25     1.13
    +++ utility.c       2000/10/31 05:29:54     1.14
    @@ -330,7 +330,7 @@
     {
        char buf[BUFSIZ];
     
    -   (void) sprintf(buf, "telnetd: %s.\r\n", msg);
    +   (void) snprintf(buf, sizeof(buf), "telnetd: %s.\r\n", msg);
        (void) write(f, buf, (int)strlen(buf));
        sleep(1);       /*XXX*/
        exit(1);
    @@ -343,7 +343,7 @@
     {
        char buf[BUFSIZ], *strerror();
     
    -   (void) sprintf(buf, "%s: %s", msg, strerror(errno));
    +   (void) snprintf(buf, sizeof(buf), "%s: %s", msg, strerror(errno));
        fatal(f, buf);
     }

$hrs: FreeBSD-SA/00:69,v 1.2 2000/11/21 16:23:13 hrs Exp $

----Next_Part(Wed_Nov_22_01:35:30_2000_41)----
