diff --git a/include/functions b/include/functions index db7f5359..7f193aa5 100644 --- a/include/functions +++ b/include/functions @@ -3052,12 +3052,12 @@ SafeInput() { exitcode=1 - # By default remove only special or undefined characters + # Test against the string with a generic test set if [ $# -eq 1 ]; then input="$1" - # Allow only a common set of characters in first parameter - cleaned=$(echo "$input" | sed 's/[^a-zA-Z0-9\._:=-]//g') - # If know what to test against, then see if input matches the specified class + # Only allow common set of characters: a-z, A-Z, 0-9, /._-:= + cleaned=$(echo "$input" | sed 's/[^a-zA-Z0-9\/\._:=-]//g') + # If two parameters are specified, then test input against specified class elif [ $# -eq 2 ]; then input="$1" testchars="$2"