Force binary string encoding in ruby 1.9.1, fix up a bad index call in x86.rb

git-svn-id: file:///home/svn/framework3/trunk@6618 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2009-06-03 03:02:42 +00:00
parent 2b4e0f440b
commit 0e35efaea2
3 changed files with 6 additions and 3 deletions

View File

@ -263,6 +263,7 @@ class Encoder < Module
# initialized and is ready to go. # initialized and is ready to go.
# #
def do_encode(state) def do_encode(state)
# Copy the decoder stub since we may need to modify it # Copy the decoder stub since we may need to modify it
stub = decoder_stub(state).dup stub = decoder_stub(state).dup

View File

@ -28,8 +28,10 @@ if (RUBY_VERSION =~ /^1\.9\./)
puts " issues trying to use this version with the Metasploit Framework" puts " issues trying to use this version with the Metasploit Framework"
# Force binary encoding # Force binary encoding for Ruby versions that support it
# Encoding.default_external = Encoding.default_internal = "binary" if(Object.const_defined?('Encoding') and Encoding.respond_to?('default_external='))
Encoding.default_external = Encoding.default_internal = "binary"
end
end end

View File

@ -474,7 +474,7 @@ module X86
end end
pad = 0 pad = 0
while (pad < (128-12) and badchars.index( (256-12-pad))) while (pad < (128-12) and badchars.index( (256-12-pad).chr))
pad += 4 pad += 4
end end