harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r759949 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
Date Mon, 30 Mar 2009 12:50:24 GMT
Author: tellison
Date: Mon Mar 30 12:50:23 2009
New Revision: 759949

URL: http://svn.apache.org/viewvc?rev=759949&view=rev
Log:
Apply patch HARMONY-6131 ([classlib/luni] check for invalid socket before I/O operations)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c?rev=759949&r1=759948&r2=759949&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
Mon Mar 30 12:50:23 2009
@@ -371,6 +371,10 @@
   I_32 result, localCount;
 
   hysocketP = getJavaIoFileDescriptorContentsAsAPointer(env, fd);
+  if (!hysock_socketIsValid(hysocketP)) {
+    throwJavaNetSocketException(env, HYPORT_ERROR_SOCKET_BADSOCKET);
+    return (jint) 0;
+  }
 
   /* A non-zero timeout will first check, and potentially wait, to see if any
    * bytes are available
@@ -448,6 +452,10 @@
   I_32 result;
 
   hysocket_t socketP = getJavaIoFileDescriptorContentsAsAPointer(env, fd);
+  if (!hysock_socketIsValid(socketP)) {
+    throwJavaNetSocketException(env, HYPORT_ERROR_SOCKET_BADSOCKET);
+    return (jint) 0;
+  }
 
   result = hysock_write(socketP, (U_8 *) message, (I_32) count, HYSOCK_NOFLAGS);
   if (0 > result) {



Mime
View raw message