knot: backport segfault fix for knsupdate.
This commit is contained in:
parent
42602f3661
commit
0aaa7a9ed4
|
@ -0,0 +1,48 @@
|
||||||
|
From 8a6645dab63d8fa7932c7d8f747fe33e8cc97e84 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Salzman <daniel.salzman@nic.cz>
|
||||||
|
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
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Template file for 'knot'
|
# Template file for 'knot'
|
||||||
pkgname=knot
|
pkgname=knot
|
||||||
version=3.2.2
|
version=3.2.2
|
||||||
revision=1
|
revision=2
|
||||||
build_style=gnu-configure
|
build_style=gnu-configure
|
||||||
configure_args="
|
configure_args="
|
||||||
--disable-silent-rules
|
--disable-silent-rules
|
||||||
|
|
Loading…
Reference in New Issue