From 613f0059965239e5452a0507f06d92482bdf55b4 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sat, 25 Nov 2017 14:35:59 -0800 Subject: [PATCH] msg: Allow zero length TLVs. 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 --- 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");