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.
This commit is contained in:
Dirk 2017-10-08 21:40:28 +02:00
parent 833f724689
commit e8e4609495

View File

@ -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. # 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() { # this is intentionally the same.
printf -- "%b" "${1//%/%%}" safe_echo() { printf -- "%b" "${1//%/%%}"; }
html_out "$1" tm_out() { printf -- "%b" "${1//%/%%}"; }
} tmln_out() { printf -- "%b" "${1//%/%%}\n"; }
outln() { out "$1\n"; }
tm_out(){ out() { printf -- "%b" "${1//%/%%}"; html_out "$1"; }
printf -- "%b" "${1//%/%%}" outln() { printf -- "%b" "${1//%/%%}\n"; html_out "$1"; }
}
tmln_out() { tm_out "$1\n"; }
#TODO: Still no shell injection safe but if just run it from the cmd line: that's fine #TODO: Still no shell injection safe but if just run it from the cmd line: that's fine