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:
parent
f804d42ddc
commit
a677749f5b
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user