There is currently no way how to systematically avoid
the dangers of scripts contaning material e.g. system("rm -rf .") or plot "<rm -rf /" . This makes it impossible to use gnuplot as plug-in in other software packages which is a pity.
It would be good if gnuplot know some commandline parameter or spec. binary which runs without accessing external commands of the system.
This issue has been discussed at many times. It is basically impossible for gnuplot's parser to be made smart enough to detect all the myriad ways a malicious outcome could be triggered. This is the wrong approach to the problem. Instead, if it is necessary to have untrusted users running gnuplot, or to run gnuplot on untrusted input, you should create a chroot jail or other sandbox for the program to run in.
Unfortuantely your solution is problematic since it won't be portable if you write crossplatform code.
I don't know the gnuplot code, but it seems to me not clever to catch this kind of problems at the parser level.
Instead I would suppose that there is some kind of function used for calling _any_ external code which would be
forbidden in this mode?
http://objectmix.com/graphics/139815-embedding-gnuplot-safe-mode.html
i see. pitty.