Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-239108

Server does not check if the position is null after receiving teleport confirmation packet

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Awaiting Response
    • None
    • 1.17.1, 21w41a
    • None
    • Plausible
    • (Unassigned)

      ServerPlayNetworkHandler#onTeleportConfirm (yarn name) does not check that this.requestedTeleportPos is non-null. A modded client can send TeleportConfirmC2SPacket with the teleport confirmation ID (usually 1 after logging in) to vanilla server, which will log fatal error (NullPointerException inside that method) on the server. However, this does not seem to actually crash the server. Since there is already a check for the confirmation ID, adding && this.requestedTeleportPos != null to that if-clause should be enough.

      Relates to MC-200000

        public void onTeleportConfirm(TeleportConfirmC2SPacket packet) {
          // Omitted unrelated code
          // There should be a check for this.requestedTeleportPos here
          if (packet.getTeleportId() == this.requestedTeleportId) {
            this.player.updatePositionAndAngles(this.requestedTeleportPos.x, this.requestedTeleportPos.y, this.requestedTeleportPos.z, this.player.getYaw(), this.player.getPitch()); // NPE here
          }
        }
      

            Unassigned Unassigned
            apple502j apple502j
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: