diff --git a/backport-Ncat-server-UDP-do-not-quit-after-EOF-on-STDIN.-Fixe.patch b/backport-Ncat-server-UDP-do-not-quit-after-EOF-on-STDIN.-Fixe.patch new file mode 100644 index 0000000..50cdc79 --- /dev/null +++ b/backport-Ncat-server-UDP-do-not-quit-after-EOF-on-STDIN.-Fixe.patch @@ -0,0 +1,31 @@ +From d4e769197afccf425ec16dae5faeece72e8a5130 Mon Sep 17 00:00:00 2001 +From: dmiller +Date: Thu, 27 Jul 2023 17:31:48 +0000 +Subject: [PATCH] Ncat server UDP: do not quit after EOF on STDIN. Fixes #2685 + +Conflict: NA +Reference: https://github.com/nmap/nmap/commit/d4e769197afccf425ec16dae5faeece72e8a5130 + +diff --git a/ncat/ncat_listen.c b/ncat/ncat_listen.c +index 3cecb64f8..c307c68c4 100644 +--- a/ncat/ncat_listen.c ++++ b/ncat/ncat_listen.c +@@ -376,13 +376,13 @@ restart_fd_loop: + } else { + /* Read from stdin and write to all clients. */ + rc = read_stdin(); +- if (rc == 0) { ++ if (rc == 0 && type == SOCK_STREAM) { + if (o.proto != IPPROTO_TCP || (o.proto == IPPROTO_TCP && o.sendonly)) { + /* There will be nothing more to send. If we're not + receiving anything, we can quit here. */ + return 0; + } +- if (!o.noshutdown && type == SOCK_STREAM) shutdown_sockets(SHUT_WR); ++ if (!o.noshutdown) shutdown_sockets(SHUT_WR); + } + if (rc < 0) + return 1; +-- +2.33.0 + diff --git a/nmap.spec b/nmap.spec index 35f11b9..0f3813b 100644 --- a/nmap.spec +++ b/nmap.spec @@ -3,7 +3,7 @@ Name: nmap Epoch: 2 Version: 7.94 -Release: 2 +Release: 3 License: Nmap Summary: A tool for network discovery and security auditing. Requires: %{name}-ncat = %{epoch}:%{version}-%{release} @@ -22,6 +22,7 @@ Patch0003: nmap-replace-sensitive-words.patch Patch0004: backport-upgrade-libpcre-to-PCRE2-10.42.patch Patch0005: backport-remove-nse_pcrelib-from-build.patch Patch0006: backport-nping-fix-out-of-bounds-access.patch +Patch0007: backport-Ncat-server-UDP-do-not-quit-after-EOF-on-STDIN.-Fixe.patch %define pixmap_srcdir zenmap/share/pixmaps @@ -69,6 +70,12 @@ ln -s ncat %{buildroot}%{_bindir}/nc %{_mandir}/man1/*.1.gz %changelog +* Tue Sep 12 2023 xingwei - 2:7.94-3 +- Type:bugfix +- CVE: +- SUG:NA +- DESC:Ncat server UDP: do not quit after EOF on STDIN + * Wed Aug 23 2023 xingwei - 2:7.94-2 - Type:bugfix - CVE: