From 1287cb2f9f004c93349a36ec37fd38e561fc89cb Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Wed, 30 Oct 2024 22:27:31 +0100 Subject: [PATCH] Don't allow blank server address --- src/main/java/net/raphimc/viaproxy/util/AddressUtil.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/net/raphimc/viaproxy/util/AddressUtil.java b/src/main/java/net/raphimc/viaproxy/util/AddressUtil.java index d3d1b0c..cda2895 100644 --- a/src/main/java/net/raphimc/viaproxy/util/AddressUtil.java +++ b/src/main/java/net/raphimc/viaproxy/util/AddressUtil.java @@ -31,6 +31,10 @@ import java.net.SocketAddress; public class AddressUtil { public static SocketAddress parse(final String serverAddress, final ProtocolVersion version) { + if (serverAddress.isBlank()) { + throw new IllegalArgumentException("Server address cannot be blank"); + } + if (serverAddress.startsWith("file:///") || serverAddress.startsWith("unix:///")) { // Unix Socket final String filePath = serverAddress.substring(7);