From 828f56cf22e753717fb01546bb8a9503bef8f72a Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Thu, 30 Nov 2023 14:17:29 +0100 Subject: [PATCH] log: warning for potential script crash --- gmod/initConfig.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gmod/initConfig.sh b/gmod/initConfig.sh index fb61e95..4c6aeff 100644 --- a/gmod/initConfig.sh +++ b/gmod/initConfig.sh @@ -13,6 +13,10 @@ CFG_PATH="${SERVER_PATH}/garrysmod/cfg/gmodserver.cfg" function configReplace() { source="$1" target="\"$2\"" + + if ! echo "$2" | grep -qe "^[a-zA-Z0-9_-]+$"; then + echo "[initConfig.sh]Warning your configured value for $source doesn't match regex ^[a-zA-Z0-9_-]+$. Special symbols could crash this script because they are not sanitized." + fi count=$(grep -Poc "($source).+" "${CFG_PATH}" || echo 0)