From c6c0c0e3a7980e88c242c0008615d34305d320b0 Mon Sep 17 00:00:00 2001 From: ORelio Date: Sun, 15 May 2016 14:37:06 +0200 Subject: [PATCH] Prevent invalid chars in logfile path A proper error message is shown and bot is unloaded. Fix #153 --- MinecraftClient/ChatBots/ChatLog.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MinecraftClient/ChatBots/ChatLog.cs b/MinecraftClient/ChatBots/ChatLog.cs index 54468253..38faec79 100644 --- a/MinecraftClient/ChatBots/ChatLog.cs +++ b/MinecraftClient/ChatBots/ChatLog.cs @@ -53,6 +53,11 @@ namespace MinecraftClient.ChatBots saveChat = false; break; } + if (String.IsNullOrEmpty(file) || file.IndexOfAny(Path.GetInvalidPathChars()) >= 0) + { + LogToConsole("Path '" + file + "' contains invalid characters."); + UnloadBot(); + } } public static MessageFilter str2filter(string filtername)