mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-09 09:58:43 +00:00
8026806: Incomplete test of getaddrinfo() return value could lead to incorrect exception for Windows Inet 6
Check getaddrinfo return value before calling WSAGetLastError. Reviewed-by: alanb, dsamersoff
This commit is contained in:
parent
11d02a8031
commit
7ebab2dbcd
@ -131,18 +131,20 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
|
||||
|
||||
error = getaddrinfo(hostname, NULL, &hints, &res);
|
||||
|
||||
if (WSAGetLastError() == WSATRY_AGAIN) {
|
||||
NET_ThrowByNameWithLastError(env,
|
||||
JNU_JAVANETPKG "UnknownHostException",
|
||||
hostname);
|
||||
JNU_ReleaseStringPlatformChars(env, host, hostname);
|
||||
return NULL;
|
||||
} else if (error) {
|
||||
/* report error */
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
|
||||
(char *)hostname);
|
||||
JNU_ReleaseStringPlatformChars(env, host, hostname);
|
||||
return NULL;
|
||||
if (error) {
|
||||
if (WSAGetLastError() == WSATRY_AGAIN) {
|
||||
NET_ThrowByNameWithLastError(env,
|
||||
JNU_JAVANETPKG "UnknownHostException",
|
||||
hostname);
|
||||
JNU_ReleaseStringPlatformChars(env, host, hostname);
|
||||
return NULL;
|
||||
} else {
|
||||
/* report error */
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
|
||||
(char *)hostname);
|
||||
JNU_ReleaseStringPlatformChars(env, host, hostname);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
int i = 0;
|
||||
int inetCount = 0, inet6Count = 0, inetIndex, inet6Index;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user