Fix tracefile setting, C type errors (#2255510)

Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
This commit is contained in:
Florian Weimer 2023-12-21 13:06:01 +01:00
parent d468a24868
commit b44da22349
2 changed files with 44 additions and 1 deletions

38
telnet-c99.patch Normal file
View File

@ -0,0 +1,38 @@
The changes to telnet/commands.c fix fix a crash in the tracefile
command on 64-bit architectures due to pointer truncation.
The telnetd.c change is just to avoid a future compiler error.
diff -ur netkit-telnet-0.17.orig/telnet/commands.c netkit-telnet-0.17/telnet/commands.c
--- netkit-telnet-0.17.orig/telnet/commands.c 2023-12-21 12:28:51.146313891 +0100
+++ netkit-telnet-0.17/telnet/commands.c 2023-12-21 12:58:47.177886556 +0100
@@ -843,7 +843,7 @@
struct termios new_tc;
#endif
-typedef void (*set_handler_t) P((int));
+typedef void (*set_handler_t) P((char *));
struct setlist {
const char *name; /* name */
const char *help; /* help information */
@@ -857,7 +857,7 @@
#endif
{ "escape", "character to escape back to telnet command mode", 0, &escape },
{ "rlogin", "rlogin escape character", 0, &rlogin },
- { "tracefile", "file to write trace information to", (set_handler_t)SetNetTrace, (cc_t *)NetTraceFile},
+ { "tracefile", "file to write trace information to", SetNetTrace, (cc_t *)NetTraceFile},
{ " ", "", 0, NULL },
{ " ", "The following need 'localchars' to be toggled true", 0, 0 },
{ "flushoutput", "character to cause an Abort Output", 0, &termFlushChar },
diff -ur netkit-telnet-0.17.orig/telnetd/telnetd.c netkit-telnet-0.17/telnetd/telnetd.c
--- netkit-telnet-0.17.orig/telnetd/telnetd.c 2023-12-21 12:28:51.149313860 +0100
+++ netkit-telnet-0.17/telnetd/telnetd.c 2023-12-21 12:29:51.396695540 +0100
@@ -385,7 +385,7 @@
}
#endif /* defined(HAS_IPPROTO_IP) && defined(IP_TOS) */
net = s;
- doit(&from, fromlen);
+ doit((struct sockaddr *) &from, fromlen);
/* NOTREACHED */
return 0;
} /* end of main */

View File

@ -3,7 +3,7 @@
Summary: The client program for the Telnet remote login protocol
Name: telnet
Version: 0.17
Release: 90%{?dist}
Release: 91%{?dist}
Epoch: 1
License: BSD-3-Clause AND BSD-4-Clause AND BSD-4-Clause-UC
Source0: ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/netkit-telnet-%{version}.tar.gz
@ -42,6 +42,7 @@ Patch31: netkit-telnet-0.17-telnetrc.patch
Patch32: telnet-log-address.patch
Patch33: telnet-0.17-overflow-exploit.patch
Patch34: telnet-0.17-pty-retry.patch
Patch35: telnet-c99.patch
BuildRequires: make
BuildRequires: ncurses-devel systemd gcc gcc-c++
@ -100,6 +101,7 @@ mv telnet telnet-NETKIT
%patch32 -p1 -b .log-address
%patch33 -p1 -b .overflow
%patch34 -p1 -b .pty-retry
%patch35 -p1 -b .c99
%build
%ifarch s390 s390x
@ -162,6 +164,9 @@ install -D -p -m644 %SOURCE6 ${RPM_BUILD_ROOT}%{_unitdir}/telnet.socket
%{_mandir}/man8/telnetd.8*
%changelog
* Thu Dec 21 2023 Florian Weimer <fweimer@redhat.com> - 1:0.17-91
- Fix tracefile setting, C type errors (#2255510)
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1:0.17-90
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild