Don't allow non digits in l=.

This commit is contained in:
Darren 'Tadgy' Austin 2024-08-11 17:43:07 +01:00
commit 7099bc7529

View file

@ -75,8 +75,8 @@ else
# Adjust 'QS_q' for the locate command by wrapping search elements in *.
QS_q="*${QS_q// /* *}*"
# Adjust 'QS_l' to not go over maximum limit of results, or use default if not supplied.
[[ -z "$QS_l" ]] && QS_l="$DEF_RESULTS"
# Adjust 'QS_l' to not go over maximum limit of results, or use default if not supplied or invalid.
[[ -z "$QS_l" ]] || [[ ! "$QS_l" =~ ^[[:digit:]]+$ ]] && QS_l="$DEF_RESULTS"
(( QS_l > MAX_RESULTS )) && QS_l="$MAX_RESULTS"
# Give success status as checks have passed.