From b963f0a75bd6c95fbfa0ac17e46ab1f9d1a787c4 Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgallagh@redhat.com>
Date: Tue, 14 Nov 2023 04:23:28 -0500
Subject: [PATCH 1/2] unix: ignore ifaddrs with NULL ifa_addr (#4218)

Passing this to uv__is_ipv6_link_local() is causing a segmentation
fault. Note that the documentation for getifaddrs() explicitly states
that this value may be NULL.

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
---
 src/unix/tcp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/unix/tcp.c b/src/unix/tcp.c
index a6b53e5913271d0c83e1d7f7e4cb8140f5f3936d..29f4532e747db50146a8b821389f4d45304c5cd0 100644
--- a/src/unix/tcp.c
+++ b/src/unix/tcp.c
@@ -233,8 +233,9 @@ static int uv__ipv6_link_local_scope_id(void) {
     return 0;
 
   for (p = ifa; p != NULL; p = p->ifa_next)
-    if (uv__is_ipv6_link_local(p->ifa_addr))
-      break;
+    if (p->ifa_addr != NULL)
+      if (uv__is_ipv6_link_local(p->ifa_addr))
+        break;
 
   rv = 0;
   if (p != NULL) {
-- 
2.41.0

