From d5d9e88851119e44bb4a509bf5d1049cb70221c2 Mon Sep 17 00:00:00 2001 From: wchen-r7 Date: Fri, 7 Jul 2017 19:00:33 -0500 Subject: [PATCH] Fix #8636, [] for NilClass in session.fs.file.download_file This fixes a [] for NilClass bug in the download_file API. The opts argument is not checked for nil before the code looks for the block_size key. Fix #8636 --- lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb b/lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb index 5ec16f86fc..72ab8bfa71 100644 --- a/lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb +++ b/lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb @@ -373,7 +373,7 @@ class File < Rex::Post::Meterpreter::Extensions::Stdapi::Fs::IO end # Keep transferring until EOF is reached... - block_size = opts['block_size'] || 1024 * 1024 + block_size = (opts && opts['block_size']) || 1024 * 1024 begin if tries # resume when timeouts encountered