aboutsummaryrefslogtreecommitdiffstats
path: root/testing/fastd/fix-segfault-with-musl.patch
diff options
context:
space:
mode:
authorJ0WI <J0WI@users.noreply.github.com>2020-05-03 00:58:47 +0200
committerLeo <thinkabit.ukim@gmail.com>2020-05-03 02:16:22 +0000
commitd142f1152b4ad0cc42d6d6762f24201a9105a2b0 (patch)
tree2127594ca6c8c7feacefd313a95249b9a925ab0c /testing/fastd/fix-segfault-with-musl.patch
parent650fa2b04f53508954e5b7a4065455807c2a04ea (diff)
downloadaports-d142f1152b4ad0cc42d6d6762f24201a9105a2b0.tar.bz2
aports-d142f1152b4ad0cc42d6d6762f24201a9105a2b0.tar.xz
testing/fastd: fix segfault and modernize
Diffstat (limited to 'testing/fastd/fix-segfault-with-musl.patch')
-rw-r--r--testing/fastd/fix-segfault-with-musl.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/testing/fastd/fix-segfault-with-musl.patch b/testing/fastd/fix-segfault-with-musl.patch
new file mode 100644
index 0000000000..fc822a1a8b
--- /dev/null
+++ b/testing/fastd/fix-segfault-with-musl.patch
@@ -0,0 +1,35 @@
+From 7d9f90ebe9dd3a7f6af1fbb97d8cc228fb0fded4 Mon Sep 17 00:00:00 2001
+From: David Bauer <mail@david-bauer.net>
+Date: Thu, 25 Jul 2019 18:51:25 +0200
+Subject: resolve: fix segmentation fault with musl >1.1.20
+
+When compiled with musl >1.1.20, fastd will crash in case it can't
+resolve a peers hostname. This is due to a changed implementation of
+freeaddrinfo in musl 1.1.21 onwards.
+
+This segfault is fixed by not calling freeaddrinfo in case the supplied
+pointer is null.
+
+Signed-off-by: David Bauer <mail@david-bauer.net>
+---
+ src/resolve.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/resolve.c b/src/resolve.c
+index 9bdfa1c..bfd2a59 100644
+--- a/src/resolve.c
++++ b/src/resolve.c
+@@ -104,7 +104,9 @@ static void * resolve_peer(void *varg) {
+
+ fastd_async_enqueue(ASYNC_TYPE_RESOLVE_RETURN, ret, sizeof(fastd_async_resolve_return_t) + n_addr*sizeof(fastd_peer_address_t));
+
+- freeaddrinfo(res);
++ if (res)
++ freeaddrinfo(res);
++
+ free(arg->hostname);
+ free(arg);
+
+--
+cgit v1.2.1
+