How do parameterized queries help against SQL injection?

后端 未结 6 1429
有刺的猬
有刺的猬 2020-11-21 22:32

In both queries 1 and 2, the text from the textbox is inserted into the database. What\'s the significance of the parameterized query here?

  1. Passing tx

6条回答
  •  臣服心动
    2020-11-21 23:12

    Parameterized queries allow the client to pass the data separately form the query text. Where on most free from text you would do validation + escaping. Of course Parameterization don't help against other kind of injection, but as the parameter are passed separately, they are not use as execution text query.

    A good analogy would be the "recent" execution bit used with most of the modern processor and Operating system to protect from buffer overflow. It still allows the buffer overflow but prevent the execution of the injected data.

提交回复
热议问题