Skip to content

Commit

Permalink
Input check for timeout in generate_dump (sonic-net#2925) (sonic-net#…
Browse files Browse the repository at this point in the history
…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 <[email protected]>
  • Loading branch information
maipbui and ycoheNvidia authored Jul 18, 2024
1 parent abb82bc commit 039f853
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/generate_dump
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 039f853

Please sign in to comment.