From c672fa347542075cebc3d03b480da26f0f6f3a56 Mon Sep 17 00:00:00 2001 From: Adel Kara Slimane Date: Mon, 7 Jun 2021 14:51:51 +0200 Subject: [PATCH] prepare: restrict user input to digits in _prompt_from_array (#261) Signed-off-by: Adel KARA SLIMANE --- linux-tkg-config/prepare | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-tkg-config/prepare b/linux-tkg-config/prepare index ca04003..eaed6df 100644 --- a/linux-tkg-config/prepare +++ b/linux-tkg-config/prepare @@ -63,7 +63,7 @@ _prompt_from_array() { if [[ -z "$REPLY" && -n "$_default_index" ]]; then _selected_index="$_default_index" break - elif [[ -n "$REPLY" && 0 -le "$REPLY" && "$REPLY" -le $_N ]]; then + elif [[ "$REPLY" =~ ^[0-9]+$ && 0 -le "$REPLY" && "$REPLY" -le $_N ]]; then _selected_index="$REPLY" break else