1
0
Fork 0

Only read first 500 bytes of a bin file to detect if it is a PHP script, refs #12032

pull/12043/head
Jordi Boggiano 2024-07-10 15:07:27 +02:00
parent 6ec76db926
commit 68f6498bd3
No known key found for this signature in database
1 changed files with 1 additions and 1 deletions

View File

@ -213,7 +213,7 @@ class BinaryInstaller
$binDir = ProcessExecutor::escape(dirname($binPath)); $binDir = ProcessExecutor::escape(dirname($binPath));
$binFile = basename($binPath); $binFile = basename($binPath);
$binContents = file_get_contents($bin); $binContents = file_get_contents($bin, false, null, 0, 500);
// For php files, we generate a PHP proxy instead of a shell one, // For php files, we generate a PHP proxy instead of a shell one,
// which allows calling the proxy with a custom php process // which allows calling the proxy with a custom php process
if (Preg::isMatch('{^(#!.*\r?\n)?[\r\n\t ]*<\?php}', $binContents, $match)) { if (Preg::isMatch('{^(#!.*\r?\n)?[\r\n\t ]*<\?php}', $binContents, $match)) {