Przeglądaj źródła

xml handling fix

Nicolas Cannasse 18 lat temu
rodzic
commit
9466e3799c
1 zmienionych plików z 4 dodań i 3 usunięć
  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)+"'";
 				throw "Invalid remoting message '"+buf.substr(pos,len)+"'";
 			// XML handling
 			// XML handling
 			var p = buf.indexOf("\\0",pos);
 			var p = buf.indexOf("\\0",pos);
-			if( p == -1 )
+			if( p == -1 || p >= len )
 				return null;
 				return null;
+			p -= pos;
 			return {
 			return {
-				msg : buf.substr(pos,p-pos),
-				bytes : p - pos + 1,
+				msg : buf.substr(pos,p),
+				bytes : p + 1,
 			};
 			};
 		}
 		}
 		if( len < msgLen )
 		if( len < msgLen )