Skip to content

Commit 6888045

Browse files
author
David Cooper
authored
Fix #2049 in 3.0
This commit fixes #2049 by converting newline characters to spaces in JSON and CSV findings. fileout() calls newline_to_spaces() on any $finding that is to be written to a JSON or CSV file. However, this only affects actual newline characters in the string, not escaped newline characters (i.e., "\n"). Escaped newline characters pass through this function unchanged, but then get converted to newline characters when they are written to the JSON and/or CSV files. This commit fixes the problem by also converting escaped newline characters ("\n") to spaces.
1 parent c076f56 commit 6888045

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

testssl.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,7 @@ fileout() {
946946

947947
if ( "$do_pretty_json" && [[ "$1" == service ]] ) || show_finding "$severity"; then
948948
local finding=$(strip_lf "$(newline_to_spaces "$(strip_quote "$3")")") # additional quotes will mess up screen output
949+
finding="${finding//\\n/ }"
949950
[[ -e "$JSONFILE" ]] && [[ ! -d "$JSONFILE" ]] && fileout_json_finding "$1" "$severity" "$finding" "$cve" "$cwe" "$hint"
950951
"$do_csv" && [[ -n "$CSVFILE" ]] && [[ ! -d "$CSVFILE" ]] && \
951952
fileout_csv_finding "$1" "$NODE/$NODEIP" "$PORT" "$severity" "$finding" "$cve" "$cwe" "$hint"

0 commit comments

Comments
 (0)