You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.0 KiB

  1. From 9710132c04cd378bd36f16a2a3d98d9c4c5fdbac Mon Sep 17 00:00:00 2001
  2. From: David Bauer <mail@david-bauer.net>
  3. Date: Thu, 25 Jul 2019 18:51:25 +0200
  4. Subject: [PATCH] resolve: fix segmentation fault with musl >1.1.20
  5. When compiled with musl >1.1.20, fastd will crash in case it can't
  6. resolve a peers hostname. This is due to a changed implementation of
  7. freeaddrinfo in musl 1.1.21 onwards.
  8. This segfault is fixed by not calling freeaddrinfo in case the supplied
  9. pointer is null.
  10. Signed-off-by: David Bauer <mail@david-bauer.net>
  11. ---
  12. src/resolve.c | 4 +++-
  13. 1 file changed, 3 insertions(+), 1 deletion(-)
  14. diff --git a/src/resolve.c b/src/resolve.c
  15. index 9bdfa1c..bfd2a59 100644
  16. --- a/src/resolve.c
  17. +++ b/src/resolve.c
  18. @@ -104,7 +104,9 @@ static void * resolve_peer(void *varg) {
  19. fastd_async_enqueue(ASYNC_TYPE_RESOLVE_RETURN, ret, sizeof(fastd_async_resolve_return_t) + n_addr*sizeof(fastd_peer_address_t));
  20. - freeaddrinfo(res);
  21. + if (res)
  22. + freeaddrinfo(res);
  23. +
  24. free(arg->hostname);
  25. free(arg);
  26. --
  27. 2.20.1