Commit Graph

13 Commits (f530ae93331f878afdeb611bffce85b99f6636fb)

Author SHA1 Message Date
Geoff Salmon 533c77115a Check that TLV length is correct when receiving TLVs.
The function, tlv_post_recv, and the functions it calls don't check
the length of the tlv before flipping the byte order of fields. An
attacker (or a really buggy client) can craft a message causing the
byte order of data outside the received message to be flipped.

None of the supported tlvs are large enough to flip bytes outside the
ptp_message struct, which could corrupt the heap. However, it's easy
to mess up the message's refcnt field, leading to memory leaks.

The fix is to check that the tlv length is what is expected when
receiving, and tlv_post_recv needs to return an int to signal when a
tlv is invalid.

Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
2013-01-22 21:08:23 +01:00
Richard Cochran 28c08dfac6 Convert the port data set TLV to and from host byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-02 20:34:44 +01:00
Richard Cochran 49a98c1fcf Convert the time properties data set TLV to and from host byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-02 15:44:59 +01:00
Richard Cochran e21280ef77 Convert the parent data set TLV to and from host byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-02 08:53:54 +01:00
Richard Cochran 2722b8587d Convert the default data set TLV to and from host byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-01 08:27:45 +01:00
Richard Cochran 6c54c31dca Introduce the time status management message.
This non-portable, implementation specific message is designed to inform
external programs about the relationship between the local clock and the
remote master clock.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-12 17:44:20 +02:00
Richard Cochran b9c4fbc11d Clean up the tlv and pmc include directives.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-26 14:39:57 +02:00
Richard Cochran 7da00ec089 Convert the current data set TLV to and from host byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-22 07:36:33 +02:00
Richard Cochran 226bd355af Convert the follow up info tlv to and from network byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-10 20:31:24 +02:00
Richard Cochran f3f62318e2 Enforce a length limit on an incoming path trace list.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-10 20:31:14 +02:00
Richard Cochran d308df8e27 Convert the management error status TLV to and from host byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-01 17:16:24 +02:00
Richard Cochran b654f6c35c Convert the management TLV to and from host byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-01 17:16:24 +02:00
Richard Cochran 4e173932d2 Add hooks for converting TLV values to and from host byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-01 17:16:24 +02:00