From: Richard Fairhurst Date: Fri, 13 Jul 2007 09:46:39 +0000 (+0000) Subject: strip out any control characters before writing to the db X-Git-Tag: live~8289 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/fa1397e988a252ec21548bfd575af3afce6bcc16 strip out any control characters before writing to the db --- diff --git a/app/controllers/amf_controller.rb b/app/controllers/amf_controller.rb index 5fe9b45cb..18a1c6346 100644 --- a/app/controllers/amf_controller.rb +++ b/app/controllers/amf_controller.rb @@ -288,6 +288,7 @@ EOF ymin=[ys,ymin].min; ymax=[ys,ymax].max node=points[i][2].to_i tagstr=array2tag(points[i][4]) + tagstr=tagstr.gsub(/[\000-\037]/,"") tagsql="'"+sqlescape(tagstr)+"'" # compare node @@ -404,6 +405,8 @@ EOF if v[0,6]=='(type ' then next end if insertsql !='' then insertsql +=',' end if currentsql!='' then currentsql+=',' end + k=k.gsub(/[\000-\037]/,"") + v=v.gsub(/[\000-\037]/,"") insertsql +="(#{way},'"+sqlescape(k)+"','"+sqlescape(v)+"',#{version})" currentsql+="(#{way},'"+sqlescape(k)+"','"+sqlescape(v)+"')" end