mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
MC 1.7: Skip potential extra data in tab-list items
See issue #84 for more info
This commit is contained in:
parent
f5a67090c2
commit
a6a9814163
1 changed files with 7 additions and 3 deletions
|
|
@ -90,9 +90,11 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
handler.OnTextReceived(ChatParser.ParseText(readNextString()));
|
handler.OnTextReceived(ChatParser.ParseText(readNextString()));
|
||||||
break;
|
break;
|
||||||
case 0x38:
|
case 0x38:
|
||||||
string name = readNextString();
|
int name_len = readNextVarInt();
|
||||||
|
string name = readNextString(name_len);
|
||||||
bool online = readNextBool();
|
bool online = readNextBool();
|
||||||
short ping = readNextShort();
|
short ping = readNextShort();
|
||||||
|
readData(size - getVarInt(id).Length - getVarInt(name.Length).Length - name_len - 3); //Skip extradata
|
||||||
Guid FakeUUID = new Guid(MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(name)).Take(16).ToArray());
|
Guid FakeUUID = new Guid(MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(name)).Take(16).ToArray());
|
||||||
if (online)
|
if (online)
|
||||||
{
|
{
|
||||||
|
|
@ -176,11 +178,13 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Read a string from the network
|
/// Read a string from the network
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="length">String length</param>
|
||||||
/// <returns>The string</returns>
|
/// <returns>The string</returns>
|
||||||
|
|
||||||
private string readNextString()
|
private string readNextString(int length = -1)
|
||||||
{
|
{
|
||||||
int length = readNextVarInt();
|
if (length < 0)
|
||||||
|
length = readNextVarInt();
|
||||||
if (length > 0)
|
if (length > 0)
|
||||||
{
|
{
|
||||||
byte[] cache = new byte[length];
|
byte[] cache = new byte[length];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue