From 0aaa7a9ed426ff23368ec848d38d06382e74bfbe Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Fri, 11 Nov 2022 16:01:15 +0100 Subject: [PATCH] knot: backport segfault fix for knsupdate. --- ...45dab63d8fa7932c7d8f747fe33e8cc97e84.patch | 48 +++++++++++++++++++ srcpkgs/knot/template | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/knot/patches/8a6645dab63d8fa7932c7d8f747fe33e8cc97e84.patch diff --git a/srcpkgs/knot/patches/8a6645dab63d8fa7932c7d8f747fe33e8cc97e84.patch b/srcpkgs/knot/patches/8a6645dab63d8fa7932c7d8f747fe33e8cc97e84.patch new file mode 100644 index 00000000000..0603c17b913 --- /dev/null +++ b/srcpkgs/knot/patches/8a6645dab63d8fa7932c7d8f747fe33e8cc97e84.patch @@ -0,0 +1,48 @@ +From 8a6645dab63d8fa7932c7d8f747fe33e8cc97e84 Mon Sep 17 00:00:00 2001 +From: Daniel Salzman +Date: Sun, 6 Nov 2022 13:43:27 +0100 +Subject: [PATCH] knsupdate: fix segfault due to NULL pointer access when + sending an update + +--- + src/utils/common/netio.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/src/utils/common/netio.c b/src/utils/common/netio.c +index 2fdb142b4..56017b1b9 100644 +--- a/src/utils/common/netio.c ++++ b/src/utils/common/netio.c +@@ -222,6 +222,12 @@ int net_init(const srv_info_t *local, + net->proxy.src = proxy_src; + net->proxy.dst = proxy_dst; + ++ if ((bool)(proxy_src == NULL) != (bool)(proxy_dst == NULL) || ++ (proxy_src != NULL && proxy_src->sa_family != proxy_dst->sa_family)) { ++ net_clean(net); ++ return KNOT_EINVAL; ++ } ++ + // Prepare for TLS. + if (tls_params != NULL && tls_params->enable) { + int ret = 0; +@@ -584,7 +590,7 @@ int net_send(const net_t *net, const uint8_t *buf, const size_t buf_len) + .msg_iovlen = 1 + }; + +- if (net->proxy.src->sa_family && net->proxy.dst->sa_family) { ++ if (net->proxy.src != NULL && net->proxy.src->sa_family != 0) { + int ret = proxyv2_write_header(proxy_buf, sizeof(proxy_buf), + SOCK_DGRAM, net->proxy.src, + net->proxy.dst); +@@ -638,7 +644,7 @@ int net_send(const net_t *net, const uint8_t *buf, const size_t buf_len) + .msg_iovlen = 2 + }; + +- if (net->proxy.src->sa_family && net->proxy.dst->sa_family) { ++ if (net->proxy.src != NULL && net->proxy.src->sa_family != 0) { + int ret = proxyv2_write_header(proxy_buf, sizeof(proxy_buf), + SOCK_STREAM, net->proxy.src, + net->proxy.dst); +-- +GitLab + diff --git a/srcpkgs/knot/template b/srcpkgs/knot/template index 442a8c35307..d51293f0acb 100644 --- a/srcpkgs/knot/template +++ b/srcpkgs/knot/template @@ -1,7 +1,7 @@ # Template file for 'knot' pkgname=knot version=3.2.2 -revision=1 +revision=2 build_style=gnu-configure configure_args=" --disable-silent-rules