in reply to Re^4: use of print f and sprint f
in thread use of print f and sprint f
cannot be exploitedDepends on what you mean, I guess.. Check out the perldoc, and look at the %n format. You can set values.
Suppose I have the following code:%n special: *stores* the number of characters output so far into the next variable in the parameter list
Now, if a clever hacker goes in and inputsmy $name = ...; ## from user input my $amount = ...; printf "$name : \$%.02f\n", $amount; # instead of # printf "%s : \$%.02f\n", $name, $amount;
then after the code runs, $amount will be set to 5000. This is a pretty rare set of circumstances, but still something to watch out for.$name = (" " x 5000) . "%n";
Update: see also Re: $#="%c"; possible bug
blokhead
|
---|
In Section
Seekers of Perl Wisdom