From 3397ca1e68f69259cca56751af73f3f0706b6831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C5=ABnas=20Ma=C5=BEeikis?= Date: Wed, 22 May 2019 21:46:23 +0300 Subject: Protocol: updated get_tlv and more docs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ramūnas Mažeikis --- src/common/protocol.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/common/protocol.c') diff --git a/src/common/protocol.c b/src/common/protocol.c index 8680be7..bae38d8 100644 --- a/src/common/protocol.c +++ b/src/common/protocol.c @@ -106,6 +106,8 @@ int get_tlv(struct tlv_parser *parser, struct tlv *ret) if (parser->offset + sizeof(ret->type) + sizeof(ret->length) >= parser->size) { ret = E_TLV_OVERFLOW; + } else if (parser -> offset == parser->size) { + ret = END_OF_PACKET; } else { ret->type = memcpy(&ret->type, parser->data + parser->offset, sizeof(ret->type)); parser->size += sizeof(ret->type); -- cgit v1.2.3