Source: netkit-telnet Version: 0.17 Severity: normal Dear Maintainer,
# What expected to happen - 1. Specify a port in telnetrc ( $HOME/.telnetrc) as follows * DEFAUT:8023 mode character - 2. telnet a host with specific port * telnet 192.168.1.1 8023 - The expected is that "mode character" command is executed as soon as server is connected, according to "man telnet" # What happened instead - The command in telnetrc specifying a port is not executed - But If not specifying a port, the command is executed as expected # Cause of Bug - telnetrc parsing routine ( readrc() function in telnet/command.cc ) has a flaw in comparing the port number of command-line with that of telnetrc - To proceed command processing, the result of string compare MUST not negated - The patch is as follows --- a/telnet/commands.cc +++ b/telnet/commands.cc @@ -2135,7 +2135,7 @@ static void readrc(const char *m1, const char *m2, const char *port, continue; while (fgets(line, sizeof(line), rcfile)) { ... if (gotmachine == 0) { ... if (line[0] == ':') { - if (!strncasecmp(&line[1], port, lport)) + if (strncasecmp(&line[1], port, lport)) continue; strncpy(line, &line[lport + 1], sizeof(line) - lport - 1); } ... } ... process_command(&cmdtab, margc, margv); -- System Information: Debian Release: bullseye/sid APT prefers focal-updates APT policy: (500, 'focal-updates'), (500, 'focal-security'), (500, 'focal'), (100, 'focal-backports') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 5.11.0-36-generic (SMP w/8 CPU cores) Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled