From nobody Thu Sep 29 22:36:20 2022 X-Original-To: dev-commits-src-all@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 4Mdp9x1yccz4YLdJ; Thu, 29 Sep 2022 22:36:21 +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 4Mdp9x1FJHz3T3m; Thu, 29 Sep 2022 22:36:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664490981; 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=QXfdJE62PfnYxEdZzBFPFaHt/B5pKTtl95LYM5ZDnRw=; b=KoRzJCbsq7jC086hcUBJF8j2sC8FLHxZ+ilI5N2zlnXrV7POTQJOjV/L1raKTwPwq6iR0i VVDuEaJFgpKzmcctkVs8jVZ98Pg/N1WjnwlM4dajaYA0L3jFCgqq3uS36LqVvN7YxPza4v V/EFtzMZ7r0oBLizQEU0iOgwOjgbKXl0tHRMMVKplDDETtIYKZcefXebWg0rV01+WMqvbL LLYhmNMPAbjZynDaL2/lOuzgLb/HhqKt8dkvwFp7mYIjSx8b5KYQb1/hagnuaVCqstDIXD bfP9lU+uW7UYjcAt7tFUA/kIEwVm8visBpcNrv0GgdDhac8BDyTqievW1OfQwA== 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 4Mdp9x0Hyszy6n; Thu, 29 Sep 2022 22:36:21 +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 28TMaKQg039930; Thu, 29 Sep 2022 22:36:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28TMaK1T039929; Thu, 29 Sep 2022 22:36:20 GMT (envelope-from git) Date: Thu, 29 Sep 2022 22:36:20 GMT Message-Id: <202209292236.28TMaK1T039929@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brooks Davis Subject: git: f2aa49e7fda5 - stable/12 - telnetd: fix two-byte input crash List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/12 X-Git-Reftype: branch X-Git-Commit: f2aa49e7fda515163da188ec75dba223e2e52216 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664490981; 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=QXfdJE62PfnYxEdZzBFPFaHt/B5pKTtl95LYM5ZDnRw=; b=yO6JXAdRPOosSnHetNjdp0quXg2QmjLolehVsO7iGDmJOSayjtFdxDqCJbyY4siJhGkyc5 37jlMp8XKAihEDslDiTYc3RVVgc+XrZN6nTdAmCkCM4D5OCyr08u3LVMVFGZCj9kji/hsj VOB9FmkC9NP18ne5Kol4k50kEkQz0OXLgyZli69Uwolgl1YPW2ysHFVvhrDVWOwSCiSMF5 rL9C0Z8BCwvNVqMxGo+zL36YOGq/SzthNQwiKmsM6For92wZ3xtyEqy/oMBn1MObUrwfRR qnEp5SQ14vk9dgpIzTmQKXEtL3MCxzNVbng72bWDDVKr4+wrfwXTD6UThLvU7g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664490981; a=rsa-sha256; cv=none; b=RtupTfLNfYluJq6jkg8ZBOFPbqne7RZJ/ADcWqCrKUwwDEf3ylqUytnlw3ur4GlmcUHgUU B78jmS0GydSX2wP/ivd/br569TLzVXI1Yc6VGIBFktJQ5f1EIYQvLM9EcRaWIYOcJeZYDw Kw3ByASuWyoCaKH55UC+ors7HO8AlZii2KKJWyYrGqBjnfqqh5suq6uJqV4paBKvUuN7DR hzx9UjDwtfvxVF5gyQqdnvJ4j+1ZjXdQF1eguvh0RX5pITDjA4gVnx3MDxR7JzUIcZnRDK wGnzEORaQcgL1Mj1J29oOT5NG0coYK3IS4N+IIIzfLl/xUzmM7d6KfZDEboaBg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=f2aa49e7fda515163da188ec75dba223e2e52216 commit f2aa49e7fda515163da188ec75dba223e2e52216 Author: Brooks Davis AuthorDate: 2022-09-26 17:56:51 +0000 Commit: Brooks Davis CommitDate: 2022-09-29 22:36:09 +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 (cherry picked from commit 6914ffef4e2318ca1d0ead28eafb6f06055ce0f8) --- 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