All pastes #42017 Raw Edit

Someone

public text v1 · immutable
#42017 ·published 2006-02-18 03:15 UTC
rendered paste body
Index: Mono.Unix/UnixEndPoint.cs
===================================================================
--- Mono.Unix/UnixEndPoint.cs   (revision 57025)
+++ Mono.Unix/UnixEndPoint.cs   (working copy)
@@ -59,8 +59,6 @@

                public override EndPoint Create (SocketAddress socketAddress)
                {
-                       int size = socketAddress.Size;
-                       byte [] bytes = new byte [size];
                        /*
                         * Should also check this
                         *
@@ -72,8 +70,9 @@
                                throw new ArgumentException ("socketAddress is not a unix socket address.");
                         */

-                       for (int i = 2; i < size - 2; i++) {
-                               bytes [i] = socketAddress [i];
+                       byte [] bytes = new byte [socketAddress.Size - 2];
+                       for (int i = 0; i < bytes.Length; i++) {
+                               bytes [i] = socketAddress [i + 2];
                        }

                        string name = Encoding.Default.GetString (bytes);