mojira.dev
MC-168669

RconClient.RconClient(ServerInterface, String, Socket) exception handling is faulty

The bug

The constructor net.minecraft.server.rcon.thread.RconClient.RconClient(ServerInterface, String, Socket) (Mojang name) handles the exception from Socket.setSoTimeout incorrectly:

RconClient(ServerInterface serverInterface, String string, Socket socket) {
    super(serverInterface, "RCON Client");
    this.client = socket;
    try {
        this.client.setSoTimeout(0);
    }
    catch (Exception exception) {
        this.running = false;
    }
    this.rconPassword = string;
    this.info("Rcon connection from: " + socket.getInetAddress());
}

Setting this.running = false; here has no effect since false is the default value and is only set once start() is called.

Comments 2

Is this still a problem? Also, what's the gameplay impact here?

Can confirm in 1.21.11, the obfuscated class bcs maps to RconClient and the faulty constructor is still present and unchanged.

bcs(ank $$0, String $$1, Socket $$2) {
    super("RCON Client " + String.valueOf($$2.getInetAddress()));
    ...
}

The run() method handles RCON login packet type 3 and compares against a password field, perfectly matching the known RconClient protocol behavior.

bcs(ank $$0, String $$1, Socket $$2) {
    super("RCON Client " + String.valueOf($$2.getInetAddress()));
    this.n = $$0;
    this.k = $$2;
    try {
        this.k.setSoTimeout(0);
    }
    catch (Exception $$3) {
        this.a = false;
    }
    this.m = $$1;
}

this.a is already false by default and gets overwritten to true on start():

public abstract class bcq implements Runnable {
    protected volatile boolean a;
    
    public synchronized boolean a() {
        if (this.a) return true;
        this.a = true;
        this.c = new Thread(this, this.b + " #" + e.incrementAndGet());
        this.c.start();
        return true;
    }
}

marcono1234

(Unassigned)

Community Consensus

Platform

Low

Networking

1.15.1, 1.21.11

Retrieved