ncat: Update to 7.91 and fix #12647 ncat segfault if virtmanager try to connect libvirt

Message ID 20210803131111.1523787-1-adolf.belka@ipfire.org
State Accepted
Commit 999b71cf47dc120eb1b0e558dc6a8dbbf66f7a17
Headers
Series ncat: Update to 7.91 and fix #12647 ncat segfault if virtmanager try to connect libvirt |

Commit Message

Adolf Belka Aug. 3, 2021, 1:11 p.m. UTC
  - Update from 7.80 to 7.91
- Update of rootfile
- Changelog is too long to include here
   Full details can be found in the CHANGELOG file in the source tarball
- Added patch to fix segfault - https://github.com/nmap/nmap/issues/2154
- Ran with unpatched 7.91 version
   $ touch /tmp/foo
   $ nc -U /tmp/foo
   Segmentation fault - flagged problem in #12647
- Ran with patched 7.91 version
   $ touch /tmp/foo
   $ nc -U /tmp/foo
   Ncat: Connection refused. - Expected behaviour

Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 lfs/ncat                                      |  7 ++++---
 ...-7.91-fix-a-unix-domain-socket-crash.patch | 21 +++++++++++++++++++
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 src/patches/ncat-7.91-fix-a-unix-domain-socket-crash.patch
  

Comments

Michael Tremer Aug. 3, 2021, 3:08 p.m. UTC | #1
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>

> On 3 Aug 2021, at 15:11, Adolf Belka <adolf.belka@ipfire.org> wrote:
> 
> - Update from 7.80 to 7.91
> - Update of rootfile
> - Changelog is too long to include here
>   Full details can be found in the CHANGELOG file in the source tarball
> - Added patch to fix segfault - https://github.com/nmap/nmap/issues/2154
> - Ran with unpatched 7.91 version
>   $ touch /tmp/foo
>   $ nc -U /tmp/foo
>   Segmentation fault - flagged problem in #12647
> - Ran with patched 7.91 version
>   $ touch /tmp/foo
>   $ nc -U /tmp/foo
>   Ncat: Connection refused. - Expected behaviour
> 
> Tested-by: Adolf Belka <adolf.belka@ipfire.org>
> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
> ---
> lfs/ncat                                      |  7 ++++---
> ...-7.91-fix-a-unix-domain-socket-crash.patch | 21 +++++++++++++++++++
> 2 files changed, 25 insertions(+), 3 deletions(-)
> create mode 100644 src/patches/ncat-7.91-fix-a-unix-domain-socket-crash.patch
> 
> diff --git a/lfs/ncat b/lfs/ncat
> index b8c8768dc..0e327a043 100644
> --- a/lfs/ncat
> +++ b/lfs/ncat
> @@ -24,7 +24,7 @@
> 
> include Config
> 
> -VER        = 7.80
> +VER        = 7.91
> 
> THISAPP    = ncat-$(VER)
> DL_FILE    = nmap-$(VER).tar.bz2
> @@ -32,7 +32,7 @@ DL_FROM    = $(URL_IPFIRE)
> DIR_APP    = $(DIR_SRC)/nmap-$(VER)
> TARGET     = $(DIR_INFO)/$(THISAPP)
> PROG       = ncat
> -PAK_VER    = 6
> +PAK_VER    = 7
> 
> DEPS       =
> 
> @@ -44,7 +44,7 @@ objects = $(DL_FILE)
> 
> $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
> 
> -$(DL_FILE)_MD5 = d37b75b06d1d40f27b76d60db420a1f5
> +$(DL_FILE)_MD5 = 239cef725863ab454590a1bb8793b72b
> 
> install : $(TARGET)
> 
> @@ -77,6 +77,7 @@ $(subst %,%_MD5,$(objects)) :
> $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
> 	@$(PREBUILD)
> 	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
> +	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/ncat-7.91-fix-a-unix-domain-socket-crash.patch	
> 	$(UPDATE_AUTOMAKE)
> 	cd $(DIR_APP) && mkdir -p build
> 	cd $(DIR_APP) && ./configure	\
> diff --git a/src/patches/ncat-7.91-fix-a-unix-domain-socket-crash.patch b/src/patches/ncat-7.91-fix-a-unix-domain-socket-crash.patch
> new file mode 100644
> index 000000000..7ffad08b2
> --- /dev/null
> +++ b/src/patches/ncat-7.91-fix-a-unix-domain-socket-crash.patch
> @@ -0,0 +1,21 @@
> +--- a/ncat/ncat_main.c	2020-10-07 17:21:42.253789857 -0600
> ++++ b/ncat/ncat_main.c	2020-10-14 21:37:31.527610020 -0600
> +@@ -846,7 +846,7 @@
> +             targetaddrs->addr.un.sun_family = AF_UNIX;
> +             strncpy(targetaddrs->addr.un.sun_path, argv[optind], sizeof(targetaddrs->addr.un.sun_path));
> +             targetaddrs->addrlen = SUN_LEN(&targetaddrs->addr.un);
> +-            o.target = argv[optind];
> ++            o.sslservername = o.target = argv[optind];
> +             optind++;
> +         } else
> + #endif
> +@@ -865,7 +865,7 @@
> +                 targetaddrs->addr.vm.svm_cid = long_cid;
> + 
> +                 targetaddrs->addrlen = sizeof(targetaddrs->addr.vm);
> +-                o.target = argv[optind];
> ++                o.sslservername = o.target = argv[optind];
> +                 optind++;
> +             }
> +         } else
> +
> -- 
> 2.32.0
>
  

Patch

diff --git a/lfs/ncat b/lfs/ncat
index b8c8768dc..0e327a043 100644
--- a/lfs/ncat
+++ b/lfs/ncat
@@ -24,7 +24,7 @@ 
 
 include Config
 
-VER        = 7.80
+VER        = 7.91
 
 THISAPP    = ncat-$(VER)
 DL_FILE    = nmap-$(VER).tar.bz2
@@ -32,7 +32,7 @@  DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/nmap-$(VER)
 TARGET     = $(DIR_INFO)/$(THISAPP)
 PROG       = ncat
-PAK_VER    = 6
+PAK_VER    = 7
 
 DEPS       =
 
@@ -44,7 +44,7 @@  objects = $(DL_FILE)
 
 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
 
-$(DL_FILE)_MD5 = d37b75b06d1d40f27b76d60db420a1f5
+$(DL_FILE)_MD5 = 239cef725863ab454590a1bb8793b72b
 
 install : $(TARGET)
 
@@ -77,6 +77,7 @@  $(subst %,%_MD5,$(objects)) :
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@$(PREBUILD)
 	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
+	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/ncat-7.91-fix-a-unix-domain-socket-crash.patch	
 	$(UPDATE_AUTOMAKE)
 	cd $(DIR_APP) && mkdir -p build
 	cd $(DIR_APP) && ./configure	\
diff --git a/src/patches/ncat-7.91-fix-a-unix-domain-socket-crash.patch b/src/patches/ncat-7.91-fix-a-unix-domain-socket-crash.patch
new file mode 100644
index 000000000..7ffad08b2
--- /dev/null
+++ b/src/patches/ncat-7.91-fix-a-unix-domain-socket-crash.patch
@@ -0,0 +1,21 @@ 
+--- a/ncat/ncat_main.c	2020-10-07 17:21:42.253789857 -0600
++++ b/ncat/ncat_main.c	2020-10-14 21:37:31.527610020 -0600
+@@ -846,7 +846,7 @@
+             targetaddrs->addr.un.sun_family = AF_UNIX;
+             strncpy(targetaddrs->addr.un.sun_path, argv[optind], sizeof(targetaddrs->addr.un.sun_path));
+             targetaddrs->addrlen = SUN_LEN(&targetaddrs->addr.un);
+-            o.target = argv[optind];
++            o.sslservername = o.target = argv[optind];
+             optind++;
+         } else
+ #endif
+@@ -865,7 +865,7 @@
+                 targetaddrs->addr.vm.svm_cid = long_cid;
+ 
+                 targetaddrs->addrlen = sizeof(targetaddrs->addr.vm);
+-                o.target = argv[optind];
++                o.sslservername = o.target = argv[optind];
+                 optind++;
+             }
+         } else
+