From nobody Mon Sep 26 17:57:32 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Mbr7c420Pz4YPLQ; Mon, 26 Sep 2022 17:57:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Mbr7c3ZM0z3PJ0; Mon, 26 Sep 2022 17:57:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664215052; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Dmlh6YIq8V1rlGQmjutcqCS9UP9vZllT5APHZ4lLQIc=; b=mXIi8fXban2Z8llYQbJ4BDbSFQih3q248uR/d3nN2rSVEzIBEGdFWMAwP4XTZjbAZQNbuN a0uSC9Ge9ELKMKfaNA1QqqL/z8g0cfgoJdGSWobBlm9ZUu3QGV0cn5Fwf4CNVZZtFJ4u6D 8z+ExBqM3SrXrw5kWVlNkOIlvzNuSpIMebSHKCvRR9jmSxaUDhVTvp+FNlr1qwJtDFRH2o EQCwQ8GzFnsBVj++bDVR1Ax5tnjlTCSvc6/MXLdfx+z+t05yuY4r8TKpidGvQ9VvgvFdk1 Y9Dgze9Bj/Z8+5jrzUfXJdEXiwkNjSoeUGBusZ4Cy4E6nNrGCqzWuJedgMsc5w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Mbr7c2V84zrJ1; Mon, 26 Sep 2022 17:57:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 28QHvWAe025212; Mon, 26 Sep 2022 17:57:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28QHvWCb025211; Mon, 26 Sep 2022 17:57:32 GMT (envelope-from git) Date: Mon, 26 Sep 2022 17:57:32 GMT Message-Id: <202209261757.28QHvWCb025211@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: 6914ffef4e23 - main - telnetd: fix two-byte input crash List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6914ffef4e2318ca1d0ead28eafb6f06055ce0f8 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664215052; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Dmlh6YIq8V1rlGQmjutcqCS9UP9vZllT5APHZ4lLQIc=; b=crCk/Ad4O4UKjN0Z1ClPSaNKcWv1UJde4IU+833OzTI+WFL/iaqOCHcSY36ap7pki8Pil3 AnDJKPke3IYwCd17oAxI7V8vwrrBkSFn/1LA8wJFPA1pYodghajd8LEOE/U1/vMrjBmtdL 0nf3/OZmcu1ef8TMPYFKaVI8Hw2o3wuWYjr/oz6tRaW+905DsInnT2eVhfD8RUF3C8NOFA r8HKGn5J2u0vdStI374w1zcORvA9CMNLQmNoJ0sFW1y+46zwOj5jFWlfQ3KXnWk8TCewWN sn+cLG0R7/1NOigdYw1n5kLKKqY+EvK+PoV0FxyarcVqeHSmo636lxvz81eDZw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664215052; a=rsa-sha256; cv=none; b=UoG71JArTsXLyG0mxyOpxjyJFf/bKTHEcSq1/A5jvLuz2JNi99B1A3uEnQ3q+tbvxTnD+4 BHx6QQjfeJ5/eyfnY8gPNBdVTBj7/jAMkoGS6F7iFXL7fg05uqGwPgSjwkdx7eFA7nbNlK 9GBL5QCioqrUaw4tNndTkrUxlVPj3k7gBGontNb22SkWIluXDRQygEmJhsSN1TcR166bKy hsWHE8gAgubX1TbGFsW8SMwHwOB4c+BszndBPuQbrwa/0avup2ByVtoCtj8X8+NVH99GAH EbtqHox/37X1P/pz2Qf5AgXEqRXRWlUWVRU1NtQ8QtnK2U8SU7qfKOeLNWhoYw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=6914ffef4e2318ca1d0ead28eafb6f06055ce0f8 commit 6914ffef4e2318ca1d0ead28eafb6f06055ce0f8 Author: Brooks Davis AuthorDate: 2022-09-26 17:56:51 +0000 Commit: Brooks Davis CommitDate: 2022-09-26 17:57:18 +0000 telnetd: fix two-byte input crash Move initialization of the slc table earlier so it doesn't get accessed before that happens. For details on the issue, see: https://pierrekim.github.io/blog/2022-08-24-2-byte-dos-freebsd-netbsd-telnetd-netkit-telnetd-inetutils-telnetd-kerberos-telnetd.html Reviewed by: cy Obtained from: NetBSD via cy Differential Revision: https://reviews.freebsd.org/D36680 --- contrib/telnet/telnetd/telnetd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/contrib/telnet/telnetd/telnetd.c b/contrib/telnet/telnetd/telnetd.c index 522877829735..e12fe70997ab 100644 --- a/contrib/telnet/telnetd/telnetd.c +++ b/contrib/telnet/telnetd/telnetd.c @@ -658,6 +658,11 @@ doit(struct sockaddr *who) int err_; /* XXX */ int ptynum; + /* + * Initialize the slc mapping table. + */ + get_slc_defaults(); + /* * Find an available pty to use. */ @@ -741,11 +746,6 @@ telnet(int f, int p, char *host) struct stat statbuf; int nfd; - /* - * Initialize the slc mapping table. - */ - get_slc_defaults(); - /* * Do some tests where it is desireable to wait for a response. * Rather than doing them slowly, one at a time, do them all