Make JSON more robust

In cases where a finding was empty (error condition), the JSON output
wasn't valid because the finding wasn't printed to file.

This commit makes sure that always a finding is printed,
also if it is empty.

FIX #1112
This commit is contained in:
Dirk 2018-09-10 18:51:43 +02:00
parent 1bfc9ca5b8
commit a24a502716
1 changed files with 15 additions and 15 deletions

View File

@ -753,7 +753,7 @@ fileout_json_print_parameter() {
"$do_json" && \
spaces=" " || \
spaces=" "
if [[ ! -z "$value" ]]; then
if [[ -n "$value" ]] || [[ "$parameter" == finding ]]; then
printf "%s%s%s%s" "$spaces" "\"$parameter\"" "$filler" ": \"$value\"" >> "$JSONFILE"
"$not_last" && printf ",\n" >> "$JSONFILE"
fi