From e8e460949554aafc858e35b1fe5cf6869eb93d86 Mon Sep 17 00:00:00 2001 From: Dirk Date: Sun, 8 Oct 2017 21:40:28 +0200 Subject: [PATCH] function safe_echo In order to santize input better there's a fucntion now which does the work . ``safe_echo()``. It is actually the same as ``tml_out()`` but is a bit snappier. --- testssl.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/testssl.sh b/testssl.sh index 3980869..94b13b4 100755 --- a/testssl.sh +++ b/testssl.sh @@ -397,16 +397,13 @@ html_out() { # here and other printf's: a little bit of sanitzing with bash internal search&replace -- otherwise printf will hiccup at '%'. '--' and %b do the rest. } -out() { - printf -- "%b" "${1//%/%%}" - html_out "$1" -} -outln() { out "$1\n"; } +# this is intentionally the same. +safe_echo() { printf -- "%b" "${1//%/%%}"; } +tm_out() { printf -- "%b" "${1//%/%%}"; } +tmln_out() { printf -- "%b" "${1//%/%%}\n"; } -tm_out(){ - printf -- "%b" "${1//%/%%}" -} -tmln_out() { tm_out "$1\n"; } +out() { printf -- "%b" "${1//%/%%}"; html_out "$1"; } +outln() { printf -- "%b" "${1//%/%%}\n"; html_out "$1"; } #TODO: Still no shell injection safe but if just run it from the cmd line: that's fine