[ubuntu-mono] [Bug 33785] UnixEndPoint misbehavior

Philipp Baer phbaer at npw.net
Sun Mar 5 11:33:45 GMT 2006


Public bug reported:
https://launchpad.net/malone/bugs/33785

Affects: mono (Ubuntu)
       Severity: Normal
       Priority: (none set)
         Status: Unconfirmed

Description:
There is a bug in the Serialize method of UnixEndPoint.cs. This bug
results in an invalid SocketAddresse: two leading zero bytes are
prepended and the two last bytes are cut off.

Mono SVN already contains a fix, which actually only changes the loop
boundaries:

Whould be great if this bug could be fixed in Dapper.


phb

===
--- trunk/mcs/class/Mono.Posix/Mono.Unix/UnixEndPoint.cs	2005/06/29 09:50:30	46710
+++ trunk/mcs/class/Mono.Posix/Mono.Unix/UnixEndPoint.cs	2006/02/18 03:33:01	57026
@@ -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);



More information about the Ubuntu-mono mailing list