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.
}
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