From 3973bc3364bbfc312e8c1bd3cb94a39890de618f Mon Sep 17 00:00:00 2001 From: David Cooper Date: Mon, 31 Aug 2020 10:35:19 -0400 Subject: [PATCH] Fix #1699 This commit fixes #1699 by setting FIRST_FINDING to true in fileout_banner() if $do_json_pretty is true. When $do_json_pretty is true, fileout_banner() calls fileout_pretty_json_banner(), which starts a new sectio in the JSON file. Setting FIRST_FINDING to true ensures that a comma is not placed before the first entry in this new section. This is the same as is done in other places when a new section is stated: fileout_section_header() and fileout_insert_warning(). --- testssl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testssl.sh b/testssl.sh index 354c360..415420a 100755 --- a/testssl.sh +++ b/testssl.sh @@ -1229,7 +1229,7 @@ fileout_pretty_json_banner() { fileout_banner() { if "$JSONHEADER"; then # "$do_json" && # here we maybe should add a banner, too - "$do_pretty_json" && (printf "%s\n" "$(fileout_pretty_json_banner)") >> "$JSONFILE" + "$do_pretty_json" && FIRST_FINDING=true && (printf "%s\n" "$(fileout_pretty_json_banner)") >> "$JSONFILE" fi }