in reply to Re^8: CGI-Upload / Bad File Number
in thread CGI-Upload / Bad File Number

I tried your example just to see what happens, but i can't find any strange behaviour.
The code passes my whole script as a string without beeing executed. In the end it appears as a post on the message-board without any changes.

I think the point is, that i use single-' characters. So no execution is performed.

But i have to admit:
In the current version it is possible to manipulate the execution by combinations of ' and \ chars or if \ is the last character at all. In this case, the evaluated string will look like this: 'foo\\'bar' or like this: 'foo\';.
In the first case 'bar' will be executed, if it contains perl-code. (I tried this one 6\'+7+\'3. so the evaluated string is '6\\'+7+\\'3'. The result was - as expected - '16').

To avoid this, i sometimes have to protect some \-characters by doubeling them, or simply remove every \-char followed by a '-char...

Replies are listed 'Best First'.
Re^10: CGI-Upload / Bad File Number
by Anonymous Monk on Jul 19, 2016 at 00:17 UTC

    :)

    I tried your example just to see what happens, but i can't find any strange behaviour.

    so a taxi is on its way down the road driver asks passanger, where now?

    passanger says BANANA, and the cars wheel is replaced with a BANANA, and they crash and burn.

    Thats not strange? that is a feature to look for in a taxi?

    Same same

    #!/usr/bin/perl -- #~ use strict; #~ use warnings; use CGI; my $query = CGI->new( { 'query; system q{echo deleting files}; $query +', 'BANANA', 'z','z' } ); my @names = $query->param; for( @names ){ $val = $query->param($_); eval "\$$_ = '$val';" or warn $@; } __END__ deleting files Can't locate object method "param" via package "BANANA" (perhaps you f +orgot to load "BANANA"?) at - line 8.

    Whoops, all the messages are lost ... is the data important? worth money?

    Red flags are red, where there is one, there are more ...