De-tainting a number

Mark Ingram mark.ingram at nexsan.com
Fri Jul 25 15:28:11 UTC 2003


Ahhhhhhh right :)

cheers Dave.

Best Regards,

Mark Ingram
Software Engineer
Nexsan Technologies
33 - 35 Parker Centre
Mansfield Road
Derby
DE21 4SZ

-----Original Message-----
From: developers-owner at bugzilla.org
[mailto:developers-owner at bugzilla.org]On Behalf Of David Miller
Sent: 25 July 2003 16:23
To: developers at bugzilla.org
Subject: Re: De-tainting a number


On 7/25/2003 4:15 PM +0100, Mark Ingram wrote:

> There is just one small problem, a $bugid of 37 gets changed to 1 when i
try
> it??
>
> I have the following code:
>
> 	my $bug_id = detaint_natural($bugid) ||
>ThrowUserError("invalid_bug_id");
> 	print "bug_id: $bug_id\n<br>bugid: $bugid";
>
> The print out looks like this:
> bug_id: 1
> bugid: 37
>
> Is there any particular reason for this?

Because that's not what I told you to do.  ;)

Here's my original code sample:

> detaint_natural($bugid) || ThrowUserError("invalid_bug_id");

Notice I'm not assigning it to a variable.  The return value is a 0/1 for
whether the value was successfully detainted or not.  If it succeeded,
$bugid will be detainted.  If it did not succeed, $bugid will now be
undefined (which is why you throw an error if it fails).
--
Dave Miller      Project Leader, Bugzilla Bug Tracking System
http://www.justdave.net/             http://www.bugzilla.org/
-
To view or change your list settings, click here:
<http://bugzilla.org/cgi-bin/mj_wwwusr?user=mark.ingram@nexsan.com>




More information about the developers mailing list