Why exactly is eval evil?

前端 未结 12 1479
没有蜡笔的小新
没有蜡笔的小新 2020-11-22 09:51

I know that Lisp and Scheme programmers usually say that eval should be avoided unless strictly necessary. I’ve seen the same recommendation for several program

12条回答
  •  遇见更好的自我
    2020-11-22 10:38

    Eval is fine, as long as you know EXACTLY what is going into it. Any user input going into it MUST be checked and validated and everything. If you don't know how to be 100% sure, then don't do it.

    Basically, a user can type in any code for the language in question, and it will execute. You can imagine for yourself how much damage he can do.

提交回复
热议问题