Skip to content

Commit b6011e6

Browse files
author
jvazquez-r7
committed
Merge branch 'meaningful_error' of https://github.com/wchen-r7/metasploit-framework into wchen-r7-meaningful_error
2 parents f2245ea + 3d3799d commit b6011e6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/msf/util/exe.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,12 @@ def self.to_win32pe(framework, code, opts={})
255255
raise RuntimeError, "The .text section does not contain an entry point"
256256
end
257257

258-
if(text.size < (payload.length + 256))
259-
raise RuntimeError, "The .text section is too small to be usable"
258+
p_length = payload.length + 256
259+
if(text.size < p_length)
260+
fname = ::File.basename(opts[:template])
261+
msg = "The .text section for '#{fname}' is too small. "
262+
msg << "Minimum is #{p_length.to_s} bytes, your .text section is #{text.size.to_s} bytes"
263+
raise RuntimeError, msg
260264
end
261265

262266
# Store some useful offsets

0 commit comments

Comments
 (0)