src/windows/native/java/net/TwoStacksPlainSocketImpl.c
Print this page
*** 206,215 ****
--- 206,216 ----
SOCKETADDRESS him;
/* The result of the connection */
int connect_res;
+ memset((char *)&him, 0, sizeof(him));
if (!IS_NULL(fdObj)) {
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
}
*** 398,408 ****
jboolean exclBind) {
/* fdObj is the FileDescriptor field on this */
jobject fdObj, fd1Obj;
/* fd is an int field on fdObj */
! int fd, fd1, len;
int ipv6_supported = ipv6_available();
/* family is an int field of iaObj */
int family;
int rv;
--- 399,409 ----
jboolean exclBind) {
/* fdObj is the FileDescriptor field on this */
jobject fdObj, fd1Obj;
/* fd is an int field on fdObj */
! int fd, fd1, len = 0;
int ipv6_supported = ipv6_available();
/* family is an int field of iaObj */
int family;
int rv;
*** 841,856 ****
Java_java_net_TwoStacksPlainSocketImpl_socketNativeSetOption(JNIEnv *env,
jobject this,
jint cmd, jboolean on,
jobject value) {
int fd, fd1;
! int level, optname, optlen;
union {
int i;
struct linger ling;
} optval;
/*
* Get SOCKET and check that it hasn't been closed
*/
fd = getFD(env, this);
fd1 = getFD1(env, this);
--- 842,858 ----
Java_java_net_TwoStacksPlainSocketImpl_socketNativeSetOption(JNIEnv *env,
jobject this,
jint cmd, jboolean on,
jobject value) {
int fd, fd1;
! int level = 0, optname = 0, optlen = 0;
union {
int i;
struct linger ling;
} optval;
+ memset((char *)&optval, 0, sizeof(optval));
/*
* Get SOCKET and check that it hasn't been closed
*/
fd = getFD(env, this);
fd1 = getFD1(env, this);
*** 1007,1027 ****
JNIEXPORT jint JNICALL
Java_java_net_TwoStacksPlainSocketImpl_socketGetOption(JNIEnv *env, jobject this,
jint opt, jobject iaContainerObj) {
int fd, fd1;
! int level, optname, optlen;
union {
int i;
struct linger ling;
} optval;
-
/*
* Get SOCKET and check it hasn't been closed
*/
fd = getFD(env, this);
fd1 = getFD1(env, this);
if (fd < 0 && fd1 < 0) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
return -1;
}
--- 1009,1029 ----
JNIEXPORT jint JNICALL
Java_java_net_TwoStacksPlainSocketImpl_socketGetOption(JNIEnv *env, jobject this,
jint opt, jobject iaContainerObj) {
int fd, fd1;
! int level = 0, optname = 0, optlen = 0;
union {
int i;
struct linger ling;
} optval;
/*
* Get SOCKET and check it hasn't been closed
*/
fd = getFD(env, this);
fd1 = getFD1(env, this);
+ memset((char *)&optval, 0, sizeof(optval));
if (fd < 0 && fd1 < 0) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
return -1;
}
*** 1041,1050 ****
--- 1043,1053 ----
jobject iaObj;
jclass iaCntrClass;
jfieldID iaFieldID;
len = sizeof(him);
+ memset((char *)&him, 0, len);
if (fd == -1) {
/* must be an IPV6 only socket. Case where both sockets are != -1
* is handled in java
*/