Skip to content

Commit

Permalink
Fix issues with NULL char not being treated properly (Thanks tornato)
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed Nov 25, 2017
1 parent 0b5b107 commit b183800
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fCraft/Network/PacketReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ sealed class PacketReader : BinaryReader {
byte[] data = ReadBytes( Packet.StringSize );
for( int i = Packet.StringSize - 1; i >= 0; i-- ) {
byte code = data[i];
if( length == 0 && !(code == 0 || code == 0x20) )
length = i + 1;
if (code == 0) code = 0x20; // NULL to space
if (length == 0 && code != 0x20) { length = i + 1; }

// Treat code as an index in code page 437
if( code < 0x20 ) {
Expand Down

0 comments on commit b183800

Please sign in to comment.