13
0
geforkt von Mirrors/Velocity

Fix forced hosts with SRV records.

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-12-30 03:52:50 -05:00
Ursprung 4167b79553
Commit 9ce4294e6e

Datei anzeigen

@ -139,8 +139,19 @@ public class HandshakeSessionHandler implements MinecraftSessionHandler {
} }
private String cleanVhost(String hostname) { private String cleanVhost(String hostname) {
int zeroIdx = hostname.indexOf('\0'); // Clean out any anything after any zero byte
return zeroIdx == -1 ? hostname : hostname.substring(0, zeroIdx); String cleaned = hostname;
int zeroIdx = cleaned.indexOf('\0');
if (zeroIdx > -1) {
cleaned = hostname.substring(0, zeroIdx);
}
// If we connect through an SRV record, there will be a period at the end (DNS usually elides
// this ending octet).
if (cleaned.endsWith(".")) {
cleaned = cleaned.substring(0, cleaned.length() - 1);
}
return cleaned;
} }
@Override @Override