1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-10-29 18:07:27 +01:00

Add specs for #read_asciiz and fix bugs there

This commit is contained in:
jvazquez-r7 2014-09-22 12:14:21 -05:00
parent f804d42ddc
commit a677749f5b
3 changed files with 10 additions and 2 deletions

View File

@ -29,8 +29,12 @@ class ImageSource
# FIXME, make me better
string = ''
loop do
char = read(offset, 1)
break if char == "\x00"
begin
char = read(offset, 1)
rescue RangeError
break
end
break if char.nil? || char == "\x00"
offset += 1
string << char
end

View File

@ -17,6 +17,8 @@ describe Rex::ImageSource::Disk do
described_class.new(file)
end
it_should_behave_like 'Rex::ImageSource::ImageSource'
describe "#initialize" do
subject(:disk_class) do
described_class.allocate

View File

@ -11,6 +11,8 @@ describe Rex::ImageSource::Memory do
described_class.new(raw_data)
end
it_should_behave_like 'Rex::ImageSource::ImageSource'
describe "#initialize" do
subject(:memory_class) do
described_class.allocate