Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 switch 语句中使用未经处理的用户输入是否有任何顾虑?谢谢
switch($_GET['userInput']) {}
除此之外,您的 switch 语句可能无法正常工作,不,这没有任何安全问题。
你永远不应该在野外接受一个变量,而不首先以某种方式、形状或形式对其进行消毒,无论它的用途是什么。
选择语句本身没有危险,但是根据您在其中放入的内容,您的情况很可能存在(如果您不清理/控制您的输入,文件创建/写入/操作和数据库处理都可能非常危险)。
I want to pass in an unknown object to a method, and then let it return the object as a List. Basically, I want something like this
object b = new MyType(); object a = new List<MyType>