File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 3052
3052
3053
3053
SafeInput () {
3054
3054
exitcode=1
3055
- # By default remove only control characters
3055
+ # By default remove only special or undefined characters
3056
3056
if [ $# -eq 1 ]; then
3057
3057
input=" $1 "
3058
- # cleaned=$(echo ${input} | tr -d '[:cntrl:]')
3059
- cleaned=$( echo " $input " | sed ' s/[^a-zA-Z0-9_ -]//g' )
3058
+ # Allow only a common set of characters in first parameter
3059
+ cleaned=$( echo " $input " | sed ' s/[^a-zA-Z0-9\._:= -]//g' )
3060
3060
# If know what to test against, then see if input matches the specified class
3061
3061
elif [ $# -eq 2 ]; then
3062
3062
input=" $1 "
3065
3065
else
3066
3066
ExitFatal " No argument or too many arguments provided to SafeInput()"
3067
3067
fi
3068
-
3068
+ # Test if the cleaned string is the same as the original input
3069
3069
if [ " ${cleaned} " = " ${input} " ]; then
3070
3070
exitcode=0
3071
3071
fi
You can’t perform that action at this time.
0 commit comments