Skip to content

Commit 4ff186c

Browse files
committed
Change the .text-too-small error message.
The original error message apparently confuses people, and this can be easily improved. See the following: https://community.rapid7.com/thread/2356
1 parent 9909579 commit 4ff186c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/msf/util/exe.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,11 @@ 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+
msg = "The .text section is too small. "
261+
msg << "Minimum is #{p_length.to_s} bytes, your .text section is #{text.size.to_s} bytes"
262+
raise RuntimeError, msg
260263
end
261264

262265
# Store some useful offsets

0 commit comments

Comments
 (0)