Revert introduction of alloc_insecure_tainted_data
[exim.git] / src / src / os.c
index c44bd3e99a7c7f0a9cc1d2a64593b576b21caf04..2bb5bbef121ffb8f97c12862578f58d35b19c0e6 100644 (file)
@@ -3,6 +3,7 @@
 *************************************************/
 
 /* Copyright (c) University of Cambridge 1995 - 2018 */
+/* Copyright (c) The Exim Maintainers 2021 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 #ifdef STAND_ALONE
@@ -495,9 +496,11 @@ if (getifaddrs(&ifalist) != 0)
 
 for (struct ifaddrs * ifa = ifalist; ifa; ifa = ifa->ifa_next)
   {
-  if (ifa->ifa_addr->sa_family != AF_INET
+  struct sockaddr * ifa_addr = ifa->ifa_addr;
+  if (!ifa_addr) continue;
+  if (ifa_addr->sa_family != AF_INET
 #if HAVE_IPV6
-    && ifa->ifa_addr->sa_family != AF_INET6
+    && ifa_addr->sa_family != AF_INET6
 #endif /* HAVE_IPV6 */
     )
     continue;
@@ -511,9 +514,9 @@ for (struct ifaddrs * ifa = ifalist; ifa; ifa = ifa->ifa_next)
   next = store_get(sizeof(ip_address_item), FALSE);
   next->next = NULL;
   next->port = 0;
-  (void)host_ntoa(-1, ifa->ifa_addr, next->address, NULL);
+  (void)host_ntoa(-1, ifa_addr, next->address, NULL);
 
-  if (yield == NULL)
+  if (!yield)
     yield = last = next;
   else
     {
@@ -831,7 +834,7 @@ return type.
 res_state
 os_get_dns_resolver_res(void)
 {
-  return &_res;
+return &_res;
 }
 
 #endif /* OS_GET_DNS_RESOLVER_RES */