Bug 265097 - telnet crash on 1) set ' ' crash 2) unset ' ' 3) help help
Summary: telnet crash on 1) set ' ' crash 2) unset ' ' 3) help help
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.0-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: Cy Schubert
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-08 19:12 UTC by Simon Josefsson
Modified: 2022-07-22 13:07 UTC (History)
2 users (show)

See Also:


Attachments
NetBSD patch 1019940:4f248823eaff packaged for FreeBSD (1.62 KB, patch)
2022-07-14 04:58 UTC, Cy Schubert
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Josefsson 2022-07-08 19:12:08 UTC
Hi.  I maintain GNU InetUtils which contains a telnet implementation that share origins with BSD code, and I can reproduce the bug reports we got on FreeBSD 13.0 as follows.  See discussions in https://lists.gnu.org/archive/html/bug-inetutils/2022-07/ with the fixes we adopted for these problems.

It would be nice to coordinate patches and code syncs, if there is anyone in the FreeBSD community that is interested in working with us in the GNU InetUtils community!

/Simon

FreeBSD 13.0-RELEASE-p3 (GENERIC) #0: Tue Jun 29 19:46:20 UTC 2021

$ telnet
telnet> set ' ' crash
Segmentation fault (core dumped)
$ telnet
telnet> unset ' '
Segmentation fault (core dumped)
$ telnet
telnet> help help
Segmentation fault (core dumped)
$
Comment 1 Simon Josefsson 2022-07-08 22:55:50 UTC
The NetBSD folks used this patch:
https://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/telnet/commands.c.diff?r1=1.79&r2=1.80&only_with_tag=MAIN
Comment 2 Cy Schubert freebsd_committer freebsd_triage 2022-07-14 04:05:00 UTC
Confirmed on 14-CURRENT.
Comment 3 Cy Schubert freebsd_committer freebsd_triage 2022-07-14 04:58:26 UTC
Created attachment 235246 [details]
NetBSD patch 1019940:4f248823eaff packaged for FreeBSD

NetBSD uses Mercurial now. This would be commit 1019940:4f248823eaff.

Can you apply this patch and test it, please. (Fix tested here.)
Comment 4 commit-hook freebsd_committer freebsd_triage 2022-07-15 13:49:12 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=a7399ea2dd7810e76dcfd52248764cb8004d49a4

commit a7399ea2dd7810e76dcfd52248764cb8004d49a4
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-07-14 04:42:06 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
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 <simon@josefsson.org>
    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(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2022-07-22 13:04:20 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=2bd84a3d19e7603bef56a4b5c2e18ff969df3ab6

commit 2bd84a3d19e7603bef56a4b5c2e18ff969df3ab6
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-07-14 04:42:06 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-07-22 13:03:03 +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 <simon@josefsson.org>
    Obtained from:  NetBSD hg commit 1019940:4f248823eaff
                    NetBSD PR/56918

    (cherry picked from commit a7399ea2dd7810e76dcfd52248764cb8004d49a4)

 contrib/telnet/telnet/commands.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2022-07-22 13:05:21 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=eeadef8fd52388bb9345df0ef472e0e7feca4afa

commit eeadef8fd52388bb9345df0ef472e0e7feca4afa
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-07-14 04:42:06 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-07-22 13:04:07 +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 <simon@josefsson.org>
    Obtained from:  NetBSD hg commit 1019940:4f248823eaff
                    NetBSD PR/56918

    (cherry picked from commit a7399ea2dd7810e76dcfd52248764cb8004d49a4)

 contrib/telnet/telnet/commands.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Comment 7 Cy Schubert freebsd_committer freebsd_triage 2022-07-22 13:07:28 UTC
Fixed.