Security: test all parameters and arguments for the presence of control characters

This commit is contained in:
Michael Boelen 2019-06-30 19:29:48 +02:00
parent fdacc00b45
commit cfaea21430
No known key found for this signature in database
GPG Key ID: 26141F77A09D7F04
1 changed files with 14 additions and 1 deletions

View File

@ -22,8 +22,21 @@
#
#################################################################################
#
# Check number of parameters submitted (at least one is needed)
PARAMCOUNT=$#
# Input validation on provided parameters and their arguments
COUNT=0
for I in "$@"; do
COUNT=$((COUNT + 1))
if ! SafeInput "${I}"; then
echo "Execution of ${PROGRAM_NAME} stopped as we found unexpected input or invalid characters in argument ${COUNT}"
echo "Do you believe this is in error? Let us know: ${PROGRAM_AUTHOR_CONTACT}"
ExitFatal
fi
done
# Parse arguments
while [ $# -ge 1 ]; do
case $1 in
# Helpers first