From nobody Fri Jul 15 13:48:17 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 4Lkt3j4RCSz4Wj31; Fri, 15 Jul 2022 13:48:17 +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 4Lkt3j3vGLz3xFh; Fri, 15 Jul 2022 13:48:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657892897; 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=2gIdq+mWVBSoDvVj4BmRwYZw0D98dYEc0xu81Blmfs8=; b=NDNBf2haF1Ikma4Y/PYw4garSdTeKZ5gZt9xFUVAvHcMFOWl7CGryKJ00mcqfARfv/R4l3 /u0VS+5DJJB/X6OWqedBJp1rknIxm/2RDtX+sWDpzd9Mx1ueCDXglM0AcIHq8nlfM1eUOg pbezwWXWirU2Q0yeybU2DqbsVhngAT20vmyDOsoVm4IOzD1psKSpK8QZDbccFxeEMnapxk qPtUOSj3vfjaYk7aimowSZEkC0z5J6ZtoAn+HUUpbWFtwkF4Rq3oo3ATx1Y3O59Nti1F1o j+gbqy7iI6NVHjhTXEdnKZA/Lq5UfNC1SGjN59fPpZInxWRW11VXGYHiI2uFuw== 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 4Lkt3j2s3YzkJm; Fri, 15 Jul 2022 13:48:17 +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 26FDmHAW006942; Fri, 15 Jul 2022 13:48:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26FDmHSL006941; Fri, 15 Jul 2022 13:48:17 GMT (envelope-from git) Date: Fri, 15 Jul 2022 13:48:17 GMT Message-Id: <202207151348.26FDmHSL006941@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: a7399ea2dd78 - main - telnet: Fix telnet segfault when invalid set or help help commands 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: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a7399ea2dd7810e76dcfd52248764cb8004d49a4 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657892897; 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=2gIdq+mWVBSoDvVj4BmRwYZw0D98dYEc0xu81Blmfs8=; b=O/62p8SrjUELrW4ooIEC6thJd0BTC83QTA5giEsHjOcWf+l8FbWw1ZLlpzfn25wPAnRrSZ ufdLaZ1bCOojfgAZXVPcVyqOwh0RYG0SgLajH4dlCeU47uhCbVy2DpowaKKEXdeWqLg3Ul e3bG79oiS1hACOn6GqHGvimpjAPXeunIXdQteTQT+jCrOhqSYn1qg4WUvWrXP3XQ1eOeUB Fe+ecTtFfdoPGIMvY8dp7M0KkLf4AX2WJ9G9/Hl7y0yq5edsJgAxCMMBgFWdr0zS3QKM9I gQudbm50pttPA0Zy6fMRImeISAyQeF8Sd8cvg8pULTZVTFyQQDHe9HGb3D85qA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1657892897; a=rsa-sha256; cv=none; b=ij4j4SGV551KIanr65vj5xvPXi7y/o40PNDNTo8aCfJfhKwDUxHWYZK3TSAExQwkU8dn7t ASbwUzRBoJoTLfqi4/3DURol32V26P+qVeb87Yhbxs9K8VSwi7A9aaWkUg0KuyQ6mc+TRr GvKekh+SXMa2vKWrFWsZIDLC9f7tFguzWVCvheccvSr/Up/tX8byDvQsXxjOPiFI8s4UMX sze3pKjX9FlQMWFK8itvaZNPAMi6fGrP+2FpJeHxttHv1+zILg7PN1wvUu4b/4CY0jac06 heI0K33FCwAQHifLv6X4rFAWXvvhrhEyeudIydaiy3GQBitxhN321Z2lE0TyOQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=a7399ea2dd7810e76dcfd52248764cb8004d49a4 commit a7399ea2dd7810e76dcfd52248764cb8004d49a4 Author: Cy Schubert AuthorDate: 2022-07-14 04:42:06 +0000 Commit: Cy Schubert CommitDate: 2022-07-15 13:38:57 +0000 telnet: Fix telnet segfault when invalid set or help help commands Silently ignore invalid set ' ' and invalid help help commands. This is the same fix applied by NetBSD in hg commit 1019940:4f248823eaff. PR: 265097 Reported by: Simon Josefsson Obtained from: NetBSD hg commit 1019940:4f248823eaff NetBSD PR/56918 MFC after: 1 week --- contrib/telnet/telnet/commands.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/telnet/telnet/commands.c b/contrib/telnet/telnet/commands.c index c52af2a81a67..6414a120ea92 100644 --- a/contrib/telnet/telnet/commands.c +++ b/contrib/telnet/telnet/commands.c @@ -939,7 +939,7 @@ setcmd(int argc, char *argv[]) } ct = getset(argv[1]); - if (ct == 0) { + if (ct == 0 || !(ct->name && ct->name[0] != ' ')) { c = GETTOGGLE(argv[1]); if (c == 0) { fprintf(stderr, "'%s': unknown argument ('set ?' for help).\n", @@ -1015,7 +1015,7 @@ unsetcmd(int argc, char *argv[]) while (argc--) { name = *argv++; ct = getset(name); - if (ct == 0) { + if (ct == 0 || !(ct->name && ct->name[0] != ' ')) { c = GETTOGGLE(name); if (c == 0) { fprintf(stderr, "'%s': unknown argument ('unset ?' for help).\n", @@ -2702,7 +2702,7 @@ help(int argc, char *argv[]) printf("?Ambiguous help command %s\n", arg); else if (c == (Command *)0) printf("?Invalid help command %s\n", arg); - else + else if (c->help) printf("%s\n", c->help); } return 0;