From f18e8e8221f3e34d1076d1cab3722bf88197dae3 Mon Sep 17 00:00:00 2001 From: Kage1 <2062390+Kage1@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:05:06 -0500 Subject: [PATCH] Restrict IPv var to 4 or 6 Restrict the grep to only 4 or 6 to prevent unintended command line switch from being executed. --- tinystatus | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tinystatus b/tinystatus index cb6f8d2..5e841fb 100755 --- a/tinystatus +++ b/tinystatus @@ -25,7 +25,7 @@ check(){ name="${3}" expectedcode="${4}" - IPv="$(echo "${ctype}" | grep -o '[0-9]$')" + IPv="$(echo "${ctype}" | grep -o '[46]$')" case "${ctype}" in http*) statuscode="$(curl -${IPv}sSkLo /dev/null -H "${useragent}" -m "${timeout}" -w "%{http_code}" "${host}" 2> "${tmp}/ko/${name}.error")";;