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 <richardcochran@gmail.com>
master
Richard Cochran 2017-11-25 14:35:59 -08:00
parent a003b4c36e
commit 613f005996
1 changed files with 1 additions and 1 deletions

2
msg.c
View File

@ -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");