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

"bad packet id 26" upon connecting after tempban expire

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 1.14.4, 1.15.2, 20w19a, 1.17
    • Fix Version/s: None
    • Labels:
      None
    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      This can be reproduced similarly to MC-84786

      That is, apply a tempban with an expire time and then connect after it expires.

      I have submitted a patch to Paper that Mojang is free to use - https://github.com/PaperMC/Paper/pull/2458

      (the code is a bit different due to CraftBukkit changes but the same logic applies)

      The relevant code is just this one line (spigot mappings), marked // NPE in PlayerList:

              if (this.k.isBanned(gameprofile)) {
                  GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.k.get(gameprofile);
      
                  chatmessage = new ChatMessage("multiplayer.disconnect.banned.reason", new Object[]{gameprofilebanentry.getReason()}); // NPE
                  if (gameprofilebanentry.getExpires() != null) {
                      chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned.expiration", new Object[]{PlayerList.g.format(gameprofilebanentry.getExpires())}));
                  }
      

      the get() call will remove the relevant entry if it has expired, and then return null.  Then it will clearly NPE on the marked line.
      The stacktrace of this occurring on the vanilla server:

      [06:30:45] [Server thread/WARN]: Failed to handle packet for /127.0.0.1:50701
      java.lang.NullPointerException: null
              at xv.a(SourceFile:357) ~[minecraft_server.jar:?]
              at we.c(SourceFile:97) ~[minecraft_server.jar:?]
              at we.b(SourceFile:63) ~[minecraft_server.jar:?]
              at jc.a(SourceFile:230) ~[minecraft_server.jar:?]
              at wb.c(SourceFile:171) [minecraft_server.jar:?]
              at net.minecraft.server.MinecraftServer.b(SourceFile:847) [minecraft_server.jar:?]
              at uk.b(SourceFile:343) [minecraft_server.jar:?]
              at net.minecraft.server.MinecraftServer.a(SourceFile:774) [minecraft_server.jar:?]
              at net.minecraft.server.MinecraftServer.run(SourceFile:642) [minecraft_server.jar:?]
              at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
      [06:30:45] [Server thread/INFO]: com.mojang.authlib.GameProfile@664932ca[id=9a9949cc-1987-3d04-b56b-cf3286adfe51,name=searchndstroy,properties={},legacy=false] (/127.0.0.1:50701) lost connection: Internal server error
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              Spottedleaf Spottedleaf
              Votes:
              4 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                CHK: