@#####
@###
@### SQL注入攻击预防装置[字符型]
@###
@### @ data ->处理的数据
@### @ length ->长度限制
@###
@### 例: strSql("SQL字符型数据",50)
@###
function strSql(data,length)
@#########################################################################
if length<>0 then data=left(data,length)
strSql="@#"&replace(data,"@#","@#@#")&"@#"
end function
@#####
@###
@### SQL注入攻击预防装置[数字型]
@###
@### @ numeric ->数字
@###
@### 例: intSql(50)
@###
@### 2004/03/04,改良版,原因:IsNumeric检测MSSQL数据类型时会误判。
@###
function intSql(Numeric)
@#########################################################################
dim MM_intTemp
On Error Resume Next
if Numeric="" then Numeric=0
MM_intTemp=csng(Numeric)
if err=0 then
intSql=Numeric
else
intSql=0
end if
end function
strSQL的length不在防御SQL注入的范围中,是我为了防止插入字符超过字段长度而出错作的一个小小的防御。
我在网上看到各式各样的SQL注入防御函数,所以很好奇,这样的函数不能防御注入吗?谁知道这两个函数的漏洞请告诉我。
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/










