Skip to content

Commit

Permalink
Verify EmotePacket entity id & ignore if player is not spawned (Cloud…
Browse files Browse the repository at this point in the history
…burstMC#1891)

(cherry picked from commit f77abc5)
  • Loading branch information
PetteriM1 authored and wode490390 committed Dec 23, 2021
1 parent c1afb31 commit 4768d69
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/cn/nukkit/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -2289,8 +2289,16 @@ public void onCompletion(Server server) {
log.warn("Violation warning from {}: {}", this.getName(), packet.toString());
break;
case ProtocolInfo.EMOTE_PACKET:
if (!this.spawned) {
return;
}
EmotePacket emotePacket = (EmotePacket) packet;
if (emotePacket.runtimeId != this.id) {
server.getLogger().warning(this.username + " sent EmotePacket with invalid entity id: " + emotePacket.runtimeId + " != " + this.id);
return;
}
for (Player viewer : this.getViewers().values()) {
viewer.dataPacket(packet);
viewer.dataPacket(emotePacket);
}
return;
case ProtocolInfo.PLAYER_INPUT_PACKET:
Expand Down

0 comments on commit 4768d69

Please sign in to comment.