in reply to Insecure dependency error and $ENV{'PATH'}

Where does $branch come from? If it's not untainted, that could be your error.

Cheers,
Ovid

New address of my CGI Course.

  • Comment on Re: Insecure dependency error and $ENV{'PATH'}

Replies are listed 'Best First'.
Re^2: Insecure dependency error and $ENV{'PATH'}
by bradcathey (Prior) on Aug 05, 2004 at 17:04 UTC
    Thanks Ovid, et al! Totally my bad (thanks for not -- me too badly—oh, the joys of programming). $branch was the culprit and had nothing to do with $ENV{'PATH'} or $newfile. But did take the advice of diotalevi and captured potential errors ($branch is set by me so not a hazard). Revised code:
    $branch =~ /^([\w-]+)$/i; $branch = $1; if ($sourcefile =~ /([\w .-]+)$/i) {; #strip off path stuff $newfile = $1; } else { return("Bad file name"); } open (OUTFILE, ">../$branch/images/$newfile") or die "Cannot open $new +file: $!"; ...

    —Brad
    "Don't ever take a fence down until you know the reason it was put up. " G. K. Chesterton
        Thanks for the gentle reprimand merlyn. I did state that I controlled $branch, but I do now see how it could get hacked anyway. Your point is well-taken.

        —Brad
        "Don't ever take a fence down until you know the reason it was put up. " G. K. Chesterton