3 ms·
I'm intrigued - any info on that? I personally use ((...)) for arithmetic tests and [[...]] for all other tests as I just target new versions of BASH and don't
by ndsipa_pomu 10mo ago
I'm intrigued - any info on that?
I personally use ((...)) for arithmetic tests and [[...]] for all other tests as I just target new versions of BASH and don't care much about POSIX compatibility.
- PhilipRoman 10mo agoThis is completely safe: [ "${payload}" -eq 42 ] This can evaluate arbitrary code: [[ "${payload}" -eq 42 ]] Here is one example of a malicious payload: payload='a[$(touch /tmp/pwned)]'
- ndsipa_pomu 10mo agoThanks. Now I need to figure out whether (( payload == 42 )) is safe.
- ndsipa_pomu 10mo agoIt appears not.