OSDN Git Service

Copy the correct number of bytes for IPv6 addresses in InetAddress_gethostbyaddr
authorLorenzo Colitti <lorenzo@google.com>
Sat, 13 Jun 2009 00:54:23 +0000 (17:54 -0700)
committerLorenzo Colitti <lorenzo@google.com>
Sat, 13 Jun 2009 00:54:23 +0000 (17:54 -0700)
libcore/luni/src/main/native/java_net_InetAddress.cpp

index c0666d5..508656f 100644 (file)
@@ -272,7 +272,7 @@ static jstring InetAddress_gethostbyaddr(JNIEnv* env, jobject obj,
             socklen = sizeof(struct sockaddr_in6);
             memset(sin6, 0, sizeof(struct sockaddr_in6));
             sin6->sin6_family = AF_INET6;
-            memcpy(&sin6->sin6_addr.s6_addr, rawAddress, 4);
+            memcpy(&sin6->sin6_addr.s6_addr, rawAddress, 16);
             env->ReleaseByteArrayElements(javaAddress, rawAddress, JNI_ABORT);
             break;
         default: