mirror of
https://github.com/drwetter/testssl.sh.git
synced 2025-01-03 23:39:45 +01:00
run_application_banner(): Fix modified in subshell bug.
Refactor the while loop so it doesn't use a subshell anymore. Also use "read -r" to prevent backslash escaping. ``` In testssl.sh line 1193: app_banners="$app_bannersline" ^-- SC2030: Modification of app_banners is local (to subshell caused by pipeline). In testssl.sh line 1195: fileout "app_banner" "WARN" "Application Banners found: $app_banners" ^-- SC2031: app_banners was modified in a subshell. That change might be lost. ``` Found by ShellCheck.
This commit is contained in:
parent
beae0ce195
commit
6a6d4880d6
@ -1182,7 +1182,7 @@ run_application_banner() {
|
||||
outln "--"
|
||||
fileout "app_banner" "INFO" "No Application Banners found"
|
||||
else
|
||||
cat $TMPFILE | while read line; do
|
||||
while IFS='' read -r line; do
|
||||
line=$(strip_lf "$line")
|
||||
if ! $first; then
|
||||
out "$spaces"
|
||||
@ -1191,7 +1191,7 @@ run_application_banner() {
|
||||
fi
|
||||
emphasize_stuff_in_headers "$line"
|
||||
app_banners="${app_banners}${line}"
|
||||
done
|
||||
done < "$TMPFILE"
|
||||
fileout "app_banner" "WARN" "Application Banners found: $app_banners"
|
||||
fi
|
||||
tmpfile_handle $FUNCNAME.txt
|
||||
|
Loading…
Reference in New Issue
Block a user