|
hzarabet -> RE: Cleaning a blacklisted character from a variable (10/28/2009 15:39:51)
|
OK, you have blacklist array with a bunch of malicious words/characters. Then the function: Function CheckStringForSQL(str) On Error Resume Next Dim lstr ' If the string is empty, return true If ( IsEmpty(str) ) Then CheckStringForSQL = false Exit Function ElseIf ( StrComp(str, "") = 0 ) Then CheckStringForSQL = false Exit Function End If lstr = LCase(str) ' Check if the string contains any patterns in our ' black list For Each s in BlackList If ( InStr (lstr, s) <> 0 ) Then CheckStringForSQL = true Exit Function End If Next CheckStringForSQL = false End Function ________________________________________________ The you have the part where you run through the REQUEST.FORM: For Each s in Request.Form If ( CheckStringForSQL(Request.Form(s)) ) Then iRequest = Request.Form(s) Response.Redirect(ErrorPage) End If Next If I do as you say and set up a new variable, this will not prevent the above script from still reading the culprit REQUEST.FORM, or will it?
|
|
|
|