2009-06-26 Gonzalo Paniagua Javier <gonzalo@novell.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Fri, 26 Jun 2009 16:34:20 +0000 (16:34 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Fri, 26 Jun 2009 16:34:20 +0000 (16:34 -0000)
* Socket.cs: MS throws a SocketException in the byte[] overload when
the value is null.

svn path=/trunk/mcs/; revision=136980

mcs/class/System/System.Net.Sockets/ChangeLog
mcs/class/System/System.Net.Sockets/Socket.cs

index 0c40cec58cd66ac405daa449471422191038855d..57a8399887d829276f94ff5b592b0a7ebb816df5 100644 (file)
@@ -1,3 +1,8 @@
+2009-06-26 Gonzalo Paniagua Javier <gonzalo@novell.com>
+
+       * Socket.cs: MS throws a SocketException in the byte[] overload when
+       the value is null.
+
 2009-05-22  Sebastien Pouliot  <sebastien@ximian.com>
 
        * Socket_2_1.cs: Do not throw a SecurityException if the security
index 8f0c98d3a49665895895cda2b4a7778f40ba0df1..bec3feede94ec86f75845c5ee43fa65d579498e3 100644 (file)
@@ -3029,6 +3029,10 @@ namespace System.Net.Sockets
                        if (disposed && closed)
                                throw new ObjectDisposedException (GetType ().ToString ());
 
+                       // I'd throw an ArgumentNullException, but this is what MS does.
+                       if (opt_value == null)
+                               throw new SocketException (10014, "Error trying to dereference an invalid pointer");
+                       
                        int error;
                        
                        SetSocketOption_internal(socket, level, name, null,
@@ -3044,6 +3048,7 @@ namespace System.Net.Sockets
                        if (disposed && closed)
                                throw new ObjectDisposedException (GetType ().ToString ());
 
+                       // NOTE: if a null is passed, the byte[] overload is used instead...
                        if (opt_value == null)
                                throw new ArgumentNullException("opt_value");