From 039f8536e6d771cf4ed119437b6bc60fb4076ed5 Mon Sep 17 00:00:00 2001 From: Mai Bui Date: Thu, 18 Jul 2024 01:24:17 -0400 Subject: [PATCH] Input check for timeout in generate_dump (#2925) (#3429) #### What I did Added input check for argument "-t" in generate_dump script #### How I did it Made sure only integer values can be received for this argument #### How to verify it Call generate_dump -t with non-integer values Co-authored-by: ycoheNvidia <99744138+ycoheNvidia@users.noreply.github.com> --- scripts/generate_dump | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/generate_dump b/scripts/generate_dump index af1eef1936..143ee502c9 100755 --- a/scripts/generate_dump +++ b/scripts/generate_dump @@ -2079,6 +2079,10 @@ while getopts ":xnvhzas:t:r:d" opt; do date --date="${SINCE_DATE}" &> /dev/null || abort "${EXT_INVALID_ARGUMENT}" "Invalid date expression passed: '${SINCE_DATE}'" ;; t) + if ! [[ ${OPTARG} =~ ^[0-9]+$ ]]; then + echo "Invalid timeout value: ${OPTARG}, Please enter a numeric value." + exit $EXT_GENERAL + fi TIMEOUT_MIN="${OPTARG}" ;; r)