From: drjaska Date: Sun, 10 Nov 2024 11:58:49 +0000 (+0200) Subject: Add a string_null check to inputbox input filter X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=xonotic%2Fxonotic-data.pk3dir.git Add a string_null check to inputbox input filter This check was forgotten and in the cases where the inputbox doesn't have a defined allowed characters list causes all input to be filtered. Fixes https://gitlab.com/xonotic/xonotic-data.pk3dir/-/issues/2946 --- diff --git a/qcsrc/menu/item/inputbox.qc b/qcsrc/menu/item/inputbox.qc index 0d77e67b4..45321e917 100644 --- a/qcsrc/menu/item/inputbox.qc +++ b/qcsrc/menu/item/inputbox.qc @@ -111,8 +111,12 @@ int len = strlen(ch); for (int i = 0; i < len; ++i) { + // if there is a list of allowed characters, forbid all other + if (me.allowedCharacters != string_null + && strstrofs(me.allowedCharacters, substring(ch, i, 1), 0) == -1) return; + + // don't allow forbidden characters if (strstrofs(me.forbiddenCharacters, substring(ch, i, 1), 0) > -1) return; - if (strstrofs(me.allowedCharacters, substring(ch, i, 1), 0) == -1) return; } if (me.maxLength > 0) {