8046901: Check jdk/src/solaris/native/sun/nio for Parfait flagged uninitialized memory
authormsheppar
Wed, 25 Feb 2015 19:36:29 +0000
changeset 29118 8782a8e91d4c
parent 29117 7956b5dc0eac
child 29119 f680ba340556
8046901: Check jdk/src/solaris/native/sun/nio for Parfait flagged uninitialized memory Reviewed-by: rriggs, alanb
jdk/src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c
jdk/src/java.base/unix/native/libnio/ch/ServerSocketChannelImpl.c
jdk/src/jdk.sctp/unix/native/libsctp/SctpNet.c
--- a/jdk/src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c	Wed Feb 25 18:41:07 2015 +0100
+++ b/jdk/src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c	Wed Feb 25 19:36:29 2015 +0000
@@ -201,7 +201,7 @@
     }
     if (senderAddr == NULL) {
         jobject isa = NULL;
-        int port;
+        int port = 0;
         jobject ia = NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa, &port);
         if (ia != NULL) {
             isa = (*env)->NewObject(env, isa_class, isa_ctorID, ia, port);
--- a/jdk/src/java.base/unix/native/libnio/ch/ServerSocketChannelImpl.c	Wed Feb 25 18:41:07 2015 +0100
+++ b/jdk/src/java.base/unix/native/libnio/ch/ServerSocketChannelImpl.c	Wed Feb 25 19:36:29 2015 +0000
@@ -84,7 +84,7 @@
     int alloc_len;
     jobject remote_ia = 0;
     jobject isa;
-    jint remote_port;
+    jint remote_port = 0;
 
     NET_AllocSockaddr(&sa, &alloc_len);
     if (sa == NULL) {
--- a/jdk/src/jdk.sctp/unix/native/libsctp/SctpNet.c	Wed Feb 25 18:41:07 2015 +0100
+++ b/jdk/src/jdk.sctp/unix/native/libsctp/SctpNet.c	Wed Feb 25 19:36:29 2015 +0000
@@ -431,7 +431,7 @@
     paddr = addr_buf;
     for (i=0; i<addrCount; i++) {
         jobject ia, isa = NULL;
-        int port;
+        int port = 0;
         sap = (struct sockaddr*)addr_buf;
         ia = NET_SockaddrToInetAddress(env, sap, &port);
         if (ia != NULL)
@@ -543,6 +543,7 @@
     void *arg;
     int arglen;
 
+    memset((char *) &linger, 0, sizeof(linger));
     if (mapSocketOption(opt, &klevel, &kopt) < 0) {
         JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
                                      "Unsupported socket option");
@@ -600,7 +601,7 @@
   (JNIEnv *env, jclass klass, jint fd, jint assocId, jobject iaObj, jint port) {
     struct sctp_setprim prim;
     struct sockaddr* sap = (struct sockaddr*)&prim.ssp_addr;
-    int sap_len;
+    int sap_len = sizeof(sap);
 
     if (NET_InetAddressToSockaddr(env, iaObj, port, sap,
                                   &sap_len, JNI_TRUE) != 0) {
@@ -625,7 +626,7 @@
    jobject iaObj, jint port, jboolean preferIPv6) {
     struct sctp_setpeerprim prim;
     struct sockaddr* sap = (struct sockaddr*)&prim.sspp_addr;
-    int sap_len;
+    int sap_len = sizeof(sap);
 
     if (NET_InetAddressToSockaddr(env, iaObj, port, sap,
                                   &sap_len, preferIPv6) != 0) {