blob: fc822a1a8bb058092af9ca5a04fe7a022fd566b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
|