The NetSync Monitor protocol features a TLV with a length of zero.
Our input message parsing assumes that every TLV will have some sort
of payload, and up until now this was true.  This patch adjusts the
parsing code to accept TLVs of length zero.

Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 msg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/msg.c b/msg.c
index 8bc14f8..9038616 100644
--- a/msg.c
+++ b/msg.c
@@ -190,7 +190,7 @@ static int suffix_post_recv(struct ptp_message *msg, 
uint8_t *ptr, int len)
        if (!ptr)
                return 0;
 
-       while (len > sizeof(struct TLV)) {
+       while (len >= sizeof(struct TLV)) {
                extra = tlv_extra_alloc();
                if (!extra) {
                        pr_err("failed to allocate TLV descriptor");
-- 
2.11.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to