<?xml version="1.0" encoding="windows-1252"?>
<node id="417523" title="Re: Security techniques every programmer should know" created="2004-12-27 04:47:19" updated="2005-02-21 11:43:04">
<type id="11">
note</type>
<author id="162080">
Jaap</author>
<data>
<field name="doctext">
In stead of blacklisting with
&lt;code&gt;
$string =~ tr/\x00-\x09\x0b\x0c\x0e-\x1f//d;
&lt;/code&gt;
one should whitelist, allowing certain characters and forbidding the rest:
&lt;code&gt;
if ($string =~ m/^([a-zA-Z0-9_])$/)
{
  my $safeString = $1; ### also untainted now
}
&lt;/code&gt;
Edit:&lt;br&gt;
Ok you say that in the Taint part, but i would add it to the "Null btes are scary" part.</field>
<field name="root_node">
417490</field>
<field name="parent_node">
417490</field>
</data>
</node>
