Skip to content

Commit

Permalink
Fix sign extension issue when encoding 2-byte number for packets. Con…
Browse files Browse the repository at this point in the history
…verting short back to ushort before it gets extended to int fixes the problem.
  • Loading branch information
ethanmoffat committed Mar 2, 2022
1 parent 5b3e02e commit 74ee1a2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion EOLib/Net/PacketBuilder.cs
Expand Up @@ -67,7 +67,7 @@ public IPacketBuilder AddChar(byte b)

public IPacketBuilder AddShort(short s)
{
return AddBytes(_encoderService.EncodeNumber(s, 2));
return AddBytes(_encoderService.EncodeNumber((ushort)s, 2));
}

public IPacketBuilder AddThree(int t)
Expand Down

0 comments on commit 74ee1a2

Please sign in to comment.