Skip to content

Commit 5ca718b

Browse files
committed
fix extra boolean read
1 parent 8343c1d commit 5ca718b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

proxy/src/main/java/com/velocitypowered/proxy/connection/client/AuthSessionHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ private void loadAppliedResourcePacks(ConnectedPlayer player, byte[] cookieData)
151151
player.resourcePackHandler().loadAppliedResourcePacks(appliedResourcePacks);
152152
} catch (SignatureException e) {
153153
logger.warn("Signature error while loading applied resource packs of {}", player.getUsername(), e);
154-
} catch (CodecException e) {
154+
} catch (IndexOutOfBoundsException | CodecException e) {
155155
logger.warn("Error while decoding applied resource packs of {}", player.getUsername(), e);
156156
}
157157
}

proxy/src/main/java/com/velocitypowered/proxy/connection/player/resourcepack/ResourcePackTransfer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package com.velocitypowered.proxy.connection.player.resourcepack;
1919

20+
import com.google.common.base.Preconditions;
2021
import com.velocitypowered.api.network.ProtocolVersion;
2122
import com.velocitypowered.api.proxy.player.ResourcePackInfo;
2223
import com.velocitypowered.proxy.protocol.ProtocolUtils;
@@ -104,6 +105,7 @@ public static byte[] createCookieData(final byte[] secret, final Collection<Reso
104105
byte[] hash = appliedResourcePack.getHash();
105106
buffer.writeBoolean(hash != null);
106107
if (hash != null) {
108+
Preconditions.checkArgument(hash.length == 20, "Hash length is not 20");
107109
buffer.writeBytes(hash);
108110
}
109111
buffer.writeBoolean(appliedResourcePack.getShouldForce());
@@ -194,7 +196,6 @@ public static Collection<ResourcePackInfo> decodeAndValidateCookieData(final byt
194196
VelocityResourcePackInfo appliedResourcePack = builder.build();
195197
appliedResourcePack.setOriginalOrigin(ORIGINS[ProtocolUtils.readVarInt(buffer)]);
196198
appliedResourcePacks.add(appliedResourcePack);
197-
buffer.readBoolean();
198199
}
199200
return appliedResourcePacks;
200201
} finally {

0 commit comments

Comments
 (0)