From 6056f243d91bbab95ae80ca624376bac81052744 Mon Sep 17 00:00:00 2001 From: m-1-k-3 Date: Tue, 28 Feb 2023 15:55:57 +0100 Subject: [PATCH] input check --- helpers/helpers_emba_parameter_parser.sh | 1 - helpers/helpers_emba_print.sh | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/helpers/helpers_emba_parameter_parser.sh b/helpers/helpers_emba_parameter_parser.sh index 4e8104850..09e069e7f 100755 --- a/helpers/helpers_emba_parameter_parser.sh +++ b/helpers/helpers_emba_parameter_parser.sh @@ -53,7 +53,6 @@ emba_parameter_parsing() { # on dependency check we need to check all deps -> activate all modules: export CWE_CHECKER=1 export FULL_EMULATION=1 - echo "reached" ;; D) # new debugging mode diff --git a/helpers/helpers_emba_print.sh b/helpers/helpers_emba_print.sh index 86cf6dc60..5f255532e 100755 --- a/helpers/helpers_emba_print.sh +++ b/helpers/helpers_emba_print.sh @@ -194,6 +194,7 @@ check_int() { check_alnum() { local INPUT_TO_CHECK="${1:-}" + [[ -z "$INPUT_TO_CHECK" ]] && return if ! [[ "$INPUT_TO_CHECK" =~ ^[a-zA-Z0-9]+$ ]]; then print_output "[-] Invalid input detected - alphanumerical only" "no_log" exit 1 @@ -202,6 +203,7 @@ check_alnum() { check_vendor() { local INPUT_TO_CHECK="${1:-}" + [[ -z "$INPUT_TO_CHECK" ]] && return if ! [[ "$INPUT_TO_CHECK" =~ ^[a-zA-Z0-9_-]+$ ]]; then print_output "[-] Invalid input detected - alphanumerical only" "no_log" exit 1 @@ -210,6 +212,7 @@ check_vendor() { check_path_input() { local INPUT_TO_CHECK="${1:-}" + [[ -z "$INPUT_TO_CHECK" ]] && return if ! [[ "$INPUT_TO_CHECK" =~ ^[a-zA-Z0-9./_~'-']+$ ]]; then print_output "[-] Invalid input detected - paths aka ~/abc/def123/ASDF only" "no_log" exit 1 @@ -218,6 +221,7 @@ check_path_input() { check_version() { local INPUT_TO_CHECK="${1:-}" + [[ -z "$INPUT_TO_CHECK" ]] && return if ! [[ "$INPUT_TO_CHECK" =~ ^[a-zA-Z0-9./_~:'-']+$ ]]; then print_output "[-] Invalid input detected - versions aka 1.2.3-a:b only" "no_log" exit 1