ソースを参照

We were failing to properly set h_errno on success, which could
cause gethostbyaddr_r to keep looping allocating more and more
memory each time till alloca finally caused a segfault. Ugh.
This fixes that as well...
-Erik

Eric Andersen 20 年 前
コミット
2309700dd3
1 ファイル変更3 行追加0 行削除
  1. 3 0
      libc/inet/resolv.c

+ 3 - 0
libc/inet/resolv.c

@@ -1755,6 +1755,7 @@ int gethostbyname_r(const char * name,
 	}
 
 	*result=result_buf;
+	*h_errnop = NETDB_SUCCESS;
 	return NETDB_SUCCESS;
 }
 #endif
@@ -1882,6 +1883,7 @@ int gethostbyname2_r(const char *name, int family,
 	}
 
 	*result=result_buf;
+	*h_errnop = NETDB_SUCCESS;
 	return NETDB_SUCCESS;
 #endif /* __UCLIBC_HAS_IPV6__ */
 }
@@ -2064,6 +2066,7 @@ int gethostbyaddr_r (const void *addr, socklen_t len, int type,
 	}
 
 	*result=result_buf;
+	*h_errnop = NETDB_SUCCESS;
 	return NETDB_SUCCESS;
 }
 #endif