2006-08-16 Alp Toker <alp@atoker.com>
authorAlp Toker <alp@mono-cvs.ximian.com>
Wed, 16 Aug 2006 15:37:44 +0000 (15:37 -0000)
committerAlp Toker <alp@mono-cvs.ximian.com>
Wed, 16 Aug 2006 15:37:44 +0000 (15:37 -0000)
  * metadata/socket-io.c: First half of the fix for #79084.
  Set sa_size to the length of the content, not that of the struct.
  Don't add NULL suffix to the content, this should be done in
  managed code if needed.

svn path=/trunk/mono/; revision=63823

mono/metadata/ChangeLog
mono/metadata/socket-io.c

index 1a800ac3896fea00619b9370653aaa9d4f3e8d45..c2990273bd3e9871aa77cb5050979ebf8a66ed1b 100644 (file)
@@ -1,3 +1,10 @@
+2006-08-16  Alp Toker  <alp@atoker.com>
+
+       * metadata/socket-io.c: First half of the fix for #79084.
+       Set sa_size to the length of the content, not that of the struct.
+       Don't add NULL suffix to the content, this should be done in
+       managed code if needed.
+
 2006-08-14  Raja R Harinath  <rharinath@novell.com>
 
        Fix part of #79012
index 1728c4f02b32e8c9089d7fa95e40432b4ccc4c53..578abc5113c04d91841e7cd407d0804b525ba33f 100644 (file)
@@ -827,7 +827,7 @@ static MonoObject *create_object_from_sockaddr(struct sockaddr *saddr,
        if (saddr->sa_family == AF_UNIX) {
                /* sa_len includes the entire sockaddr size, so we don't need the
                 * N bytes (sizeof (unsigned short)) of the family. */
-               data=mono_array_new(domain, mono_get_byte_class (), sa_size - 2);
+               data=mono_array_new(domain, mono_get_byte_class (), sa_size);
        } else
 #endif
        {
@@ -1059,7 +1059,7 @@ static struct sockaddr *create_sockaddr_from_object(MonoObject *saddr_obj,
                struct sockaddr_un *sock_un;
                int i;
 
-               /* Need a byte for the '\0' terminator, and the first
+               /* Need a byte for the '\0' terminator/prefix, and the first
                 * two bytes hold the SocketAddress family
                 */
                if (len - 2 >= MONO_SIZEOF_SUNPATH) {
@@ -1074,8 +1074,7 @@ static struct sockaddr *create_sockaddr_from_object(MonoObject *saddr_obj,
                                                                i + 2);
                }
                
-               sock_un->sun_path [len - 2] = '\0';
-               *sa_size = sizeof (struct sockaddr_un);
+               *sa_size = len;
 
                return (struct sockaddr *)sock_un;
 #endif