From d1ccc17af738b2854278220558c28c949da5914b Mon Sep 17 00:00:00 2001 From: Shuiling <132723284+shulng@users.noreply.github.com> Date: Sat, 28 Sep 2024 08:09:05 -0700 Subject: [PATCH] Fix code scanning alert no. 2: Log Injection Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- src/main/java/cc/baka9/catseedlogin/bukkit/Communication.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/cc/baka9/catseedlogin/bukkit/Communication.java b/src/main/java/cc/baka9/catseedlogin/bukkit/Communication.java index 5d226be..c6e11b2 100644 --- a/src/main/java/cc/baka9/catseedlogin/bukkit/Communication.java +++ b/src/main/java/cc/baka9/catseedlogin/bukkit/Communication.java @@ -80,7 +80,8 @@ private static void handleRequest(Socket socket) { handleKeepLoggedInRequest(playerName, time, sign); break; default: - CatSeedLogin.instance.getLogger().warning("未知请求类型: " + requestType); + String sanitizedRequestType = requestType.replace("\n", "").replace("\r", ""); + CatSeedLogin.instance.getLogger().warning("未知请求类型: " + sanitizedRequestType); break; } } catch (IOException e) {