my $exec = "/usr/local/bin/monster -i$id $filePath$file &"; qx/$exec/;
Calling exec in scalar context like this, you're feeding what appears to be user input to /bin/sh. If an external user controls the value of $id, $filePath, or $file, you'll get owned because the shell interprets metacharacters. E.g. if $id is set to `rm -rf /`, sh will execute it.
Also, I'm not sure if this is related, but there's no need for the '&' at the end of the command. You've already forked a child, so you shouldn't need to fork again. Try this:
Calling exec() in array context executes the program directly rather than feeding it to the system shell, so metacharacters won't be a problem.exec("/usr/local/bin/monster", "-i", $id, "$filePath$file");
-Matt
In reply to Re: Reaping Zombies (dont wanna wait)
by DrManhattan
in thread Reaping Zombies (dont wanna wait)
by seaver
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |