From b58931f8037f05d96938fc640551725b9ffc580c Mon Sep 17 00:00:00 2001 From: forzoni Date: Tue, 19 Jul 2016 23:43:38 -0500 Subject: [PATCH] Avoid error when generated payload is nil. --- lib/msf/core/payload_generator.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/msf/core/payload_generator.rb b/lib/msf/core/payload_generator.rb index c7787aeff5..1ef807c189 100644 --- a/lib/msf/core/payload_generator.rb +++ b/lib/msf/core/payload_generator.rb @@ -333,15 +333,15 @@ module Msf gen_payload = format_payload(encoded_payload) end - if format.to_s != 'raw' - cli_print "Final size of #{format} file: #{gen_payload.length} bytes" - end - if gen_payload.nil? raise PayloadGeneratorError, 'The payload could not be generated, check options' elsif gen_payload.length > @space and not @smallest raise PayloadSpaceViolation, 'The payload exceeds the specified space' else + if format.to_s != 'raw' + cli_print "Final size of #{format} file: #{gen_payload.length} bytes" + end + gen_payload end end