From ff527f524e9754a09c9538ebc71f2da303509025 Mon Sep 17 00:00:00 2001 From: Dirk Date: Mon, 1 Apr 2019 21:36:00 +0200 Subject: [PATCH] Safely create the CSVFILE ... before writing to it. (see #1219) --- testssl.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/testssl.sh b/testssl.sh index b2ba8ad..de30362 100755 --- a/testssl.sh +++ b/testssl.sh @@ -1001,10 +1001,11 @@ csv_header() { CSVHEADER=false else [[ -s "$CSVFILE" ]] && fatal "non-empty \"$CSVFILE\" exists. Either use \"--append\" or (re)move it" $ERR_FCREATE + touch "$CSVFILE" if "$GIVE_HINTS"; then - fileout_csv_finding "id" "fqdn/ip" "port" "severity" "finding" "cve" "cwe" "hint" > "$CSVFILE" + fileout_csv_finding "id" "fqdn/ip" "port" "severity" "finding" "cve" "cwe" "hint" else - fileout_csv_finding "id" "fqdn/ip" "port" "severity" "finding" "cve" "cwe" > "$CSVFILE" + fileout_csv_finding "id" "fqdn/ip" "port" "severity" "finding" "cve" "cwe" fi fi return 0