diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2019-06-30 20:29:48 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2019-06-30 20:29:48 +0300 |
commit | cfaea214306f38f958bc3589e60adcf591f64e21 (patch) | |
tree | 067b00000f66ac674f4f96640d5e46b4bc8516fe /include/parameters | |
parent | fdacc00b453b451a6983d6a18819e1158ef32553 (diff) |
Security: test all parameters and arguments for the presence of control characters
Diffstat (limited to 'include/parameters')
-rw-r--r-- | include/parameters | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/include/parameters b/include/parameters index 53eeecb3..c0048f72 100644 --- a/include/parameters +++ b/include/parameters @@ -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 |