diff options
author | Marzal <2069735+Marzal@users.noreply.github.com> | 2019-09-19 21:01:31 +0300 |
---|---|---|
committer | Marzal <2069735+Marzal@users.noreply.github.com> | 2019-09-19 21:01:31 +0300 |
commit | ddd87371b5b31821d0705003bfd13c1b89157af7 (patch) | |
tree | 9dbd436f7c51e37cd7233e6c2e46b6a543f6658a /include/functions | |
parent | 09a60783a69868506e8621079f8d7f42871f08ee (diff) |
Double quote to prevent globbing and word splitting.SC2086 Info
Diffstat (limited to 'include/functions')
-rw-r--r-- | include/functions | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/include/functions b/include/functions index 2484f76a..a10fb7c7 100644 --- a/include/functions +++ b/include/functions @@ -1532,12 +1532,12 @@ # Initialize users for strict mode if [ -n "${users:-}" ]; then for u in ${users}; do - user_uid=$(getent passwd ${u} 2> /dev/null | ${AWKBINARY} -F: '{print $3}') + user_uid=$(getent passwd "${u}" 2> /dev/null | ${AWKBINARY} -F: '{print $3}') # Only perform search if user exists and we had no match yet if [ -n "${user_uid}" ]; then if [ -z "${FIND}" ]; then LogText "Performing pgrep scan using uid ${user_uid}" - FIND=$(${PGREPBINARY} ${pgrep_options} -u ${user_uid} "${search}" | ${TRBINARY} '\n' ' ') + FIND=$(${PGREPBINARY} ${pgrep_options} -u "${user_uid}" "${search}" | ${TRBINARY} '\n' ' ') fi fi done @@ -1546,7 +1546,7 @@ FIND=$(${PGREPBINARY} ${pgrep_options} "${search}" | ${TRBINARY} '\n' ' ') fi else - if [ ${SHELL_IS_BUSYBOX} -eq 1 ]; then + if [ "${SHELL_IS_BUSYBOX}" -eq 1 ]; then # This search is not foolproof LogText "Performing simple ps scan (busybox)" PSOPTIONS=" -o args=" @@ -1554,16 +1554,16 @@ else if [ -n "${users}" ]; then for u in ${users}; do - user_uid=$(getent passwd ${u} 2> /dev/null | ${AWKBINARY} -F: '{print $3}') + user_uid=$(getent passwd "${u}" 2> /dev/null | ${AWKBINARY} -F: '{print $3}') # Only perform search if user exists and we had no match yet if [ -n "${user_uid}" ]; then if [ -z "${FIND}" ]; then if [ ${PARTIAL_SEARCH} -eq 1 ]; then LogText "Performing ps scan using partial match and for uid ${user_uid}" - FIND=$(${PSBINARY} -u ${user_uid} -o comm= "${search}" | ${AWKBINARY} -v pattern="${search}" '$0 ~ pattern {print}') + FIND=$(${PSBINARY} -u "${user_uid}" -o comm= "${search}" | ${AWKBINARY} -v pattern="${search}" '$0 ~ pattern {print}') else LogText "Performing ps scan using exact match and for uid ${user_uid}" - FIND=$(${PSBINARY} -u ${user_uid} -o comm= "${search}" | ${AWKBINARY} -v pattern="^${search}$" '$0 ~ pattern {print}') + FIND=$(${PSBINARY} -u "${user_uid}" -o comm= "${search}" | ${AWKBINARY} -v pattern="^${search}$" '$0 ~ pattern {print}') fi fi fi |