Skip to content

Commit eb8d4b6

Browse files
committed
Force LITTLE_ENDIAN by default
1 parent 3b1042b commit eb8d4b6

File tree

6 files changed

+20
-3
lines changed

6 files changed

+20
-3
lines changed

spec/lib/rex/ole/clsid_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
require 'rex/ole'
55

66
describe Rex::OLE::CLSID do
7+
before(:each) do
8+
Rex::OLE::Util.set_endian(Rex::OLE::LITTLE_ENDIAN)
9+
end
710

811
let(:sample_clsid) { "\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" }
912

@@ -35,7 +38,6 @@
3538

3639
describe "#to_s" do
3740
it "returns printable clsid" do
38-
Rex::OLE::Util.set_endian(Rex::OLE::LITTLE_ENDIAN)
3941
expect(clsid.to_s).to eq('33221100-5544-7766-8899-aabbccddeeff')
4042
end
4143

spec/lib/rex/ole/difat_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
require 'rex/ole'
55

66
describe Rex::OLE::DIFAT do
7+
before(:each) do
8+
Rex::OLE::Util.set_endian(Rex::OLE::LITTLE_ENDIAN)
9+
end
710

811
let(:storage) do
912
Rex::OLE::Storage.new

spec/lib/rex/ole/direntry_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
require 'rex/ole'
55

66
describe Rex::OLE::DirEntry do
7+
before(:each) do
8+
Rex::OLE::Util.set_endian(Rex::OLE::LITTLE_ENDIAN)
9+
end
710

811
let(:storage) do
912
Rex::OLE::Storage.new

spec/lib/rex/ole/header_spec.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
require 'rex/ole'
55

66
describe Rex::OLE::Header do
7+
before(:each) do
8+
Rex::OLE::Util.set_endian(Rex::OLE::LITTLE_ENDIAN)
9+
end
710

811
subject(:header) do
912
described_class.new
@@ -240,7 +243,7 @@
240243
hdr << 'A' * 16 # @_clid
241244
hdr << 'BB' # @_uMinorVersion
242245
hdr << 'CC' # @_uMajorVersion
243-
hdr << 'DD' # @_uByteOrder
246+
hdr << "\xfe\xff" # @_uByteOrder
244247
hdr << 'EE' # @_uSectorShift
245248
hdr << 'FF' # @_uMiniSectorShift
246249
hdr << '123456' # padding
@@ -275,7 +278,7 @@
275278

276279
it "sets byte order from input" do
277280
header.read(correct_fd)
278-
expect(header.instance_variable_get(:@_uByteOrder)).to eq(0x4444)
281+
expect(header.instance_variable_get(:@_uByteOrder)).to eq(Rex::OLE::LITTLE_ENDIAN)
279282
end
280283

281284
it "sets the size of sectors from input" do

spec/lib/rex/ole/minifat_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
require 'rex/ole'
55

66
describe Rex::OLE::MiniFAT do
7+
before(:each) do
8+
Rex::OLE::Util.set_endian(Rex::OLE::LITTLE_ENDIAN)
9+
end
710

811
let(:storage) do
912
Rex::OLE::Storage.new

spec/lib/rex/ole/util_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
require 'rex/ole'
55

66
describe Rex::OLE::Util do
7+
before(:each) do
8+
Rex::OLE::Util.set_endian(Rex::OLE::LITTLE_ENDIAN)
9+
end
710

811
describe ".Hexify32array" do
912
subject(:hex_array) { described_class.Hexify32array(arr) }

0 commit comments

Comments
 (0)