Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Commit

Permalink
Merge branch 'SpigotMC-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Zartec committed Mar 31, 2016
2 parents 7f88d8a + 05588c9 commit 48903ae
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ public static void writeArray(byte[] b, ByteBuf buf)

public static byte[] readArray(ByteBuf buf)
{
return readArray( buf, Short.MAX_VALUE );
return readArray( buf, buf.readableBytes() );
}

public static byte[] readArray(ByteBuf buf, int limit)
{
int len = readVarInt( buf );
Preconditions.checkArgument( len <= limit, "Cannot receive byte array longer than %d (got %s bytes)", limit, len );
Preconditions.checkArgument( len <= limit, "Cannot receive byte array longer than %s (got %s bytes)", limit, len );
byte[] ret = new byte[ len ];
buf.readBytes( ret );
return ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protoco
verifyToken = readArrayLegacy( buf );
} else
{
publicKey = readArray( buf, 128 );
verifyToken = readArray( buf, 128 );
publicKey = readArray( buf );
verifyToken = readArray( buf );
}
}

Expand Down
4 changes: 3 additions & 1 deletion proxy/src/main/java/net/md_5/bungee/EncryptionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ public class EncryptionUtil
{
try
{
keys = KeyPairGenerator.getInstance( "RSA" ).generateKeyPair();
KeyPairGenerator generator = KeyPairGenerator.getInstance( "RSA" );
generator.initialize( 1024 );
keys = generator.generateKeyPair();
} catch ( NoSuchAlgorithmException ex )
{
throw new ExceptionInInitializerError( ex );
Expand Down

0 comments on commit 48903ae

Please sign in to comment.