lan servers: don't allow ports below 1024

This commit is contained in:
Bixilon 2022-10-04 10:52:24 +02:00
parent a45bcbf52f
commit 95f288bf23
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -126,7 +126,7 @@ object LANServerListener {
rawAddress = rawAddress.split(":").toTypedArray()[1]
}
val port = rawAddress.toInt()
check(port in 1 until 65535) { "Invalid port: $port" }
check(port in 1024 until 65535) { "Invalid port: $port" }
val motd = broadcast.getBetween(MOTD_START_STRING, MOTD_END_STRING)
return Server(address = address.hostAddress + ":" + rawAddress, name = BaseComponent("LAN: #${SERVERS.size}: ", ChatComponent.of(motd)))
}