Skip to content

Commit

Permalink
IPReassembler: pack ChunkLink, since it can be arbitrarily placed in …
Browse files Browse the repository at this point in the history
…Packet::data

These two uint16_ts may end up placed at arbitrary offsets into a packet.
In order to generate proper unaligned read/write instructions, mark the
struct as packed.

This was exposed by Defensic suite IPv4 Header Fragment-offset, test 45067
and discovered by Waldin Stone.  I verified it by asserting proper alignment
of ChunkLinks and found that they were not always properly aligned.
  • Loading branch information
Derrick Pallas committed Nov 3, 2018
1 parent 85fce76 commit 8ad7a0f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion elements/ip/ipreassembler.hh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class IPReassembler : public Element { public:
struct ChunkLink {
uint16_t off;
uint16_t lastoff;
};
} __attribute__((packed));

private:

Expand Down

0 comments on commit 8ad7a0f

Please sign in to comment.