If the 'name' is coming from a Form, try limiting it within the form tags,
it's always a better idea.

<input type=text name=name MAXLENGTH=40>

OR if you insist to do it within script; use 'substr' function.

my $name = param('name');

my $limited_name = substr($name, 0, 40);

Thanks,
Sara.




----- Original Message -----
From: "David Gilden" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, November 10, 2004 11:49 PM
Subject: untainting data


Hello,


Is the following all I need to untaint data?


#!/usr/bin/perl

use CGI qw/:standard/;

my $name = param('name');

$name =~ s/(\w+)/$1/;

What can I do limit string length to 40 characters?

Thanks,

Dave

(kora musician / audiophile / webmaster @ www.coraconnection.com  / Ft.
Worth, TX, USA)

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to