Browse Source

xml handling fix

Nicolas Cannasse 18 years ago
parent
commit
9466e3799c
1 changed files with 4 additions and 3 deletions
  1. 4 3
      std/neko/net/ThreadRemotingServer.hx

+ 4 - 3
std/neko/net/ThreadRemotingServer.hx

@@ -55,11 +55,12 @@ class ThreadRemotingServer extends ThreadServer<haxe.remoting.SocketConnection,S
 				throw "Invalid remoting message '"+buf.substr(pos,len)+"'";
 			// XML handling
 			var p = buf.indexOf("\\0",pos);
-			if( p == -1 )
+			if( p == -1 || p >= len )
 				return null;
+			p -= pos;
 			return {
-				msg : buf.substr(pos,p-pos),
-				bytes : p - pos + 1,
+				msg : buf.substr(pos,p),
+				bytes : p + 1,
 			};
 		}
 		if( len < msgLen )