diff options
author | 2019-05-22 21:46:23 +0300 | |
---|---|---|
committer | 2019-05-22 21:46:23 +0300 | |
commit | 3397ca1e68f69259cca56751af73f3f0706b6831 (patch) | |
tree | f05b1228d6435f426cf1bbdbda282e28177efc86 /src/common | |
parent | 5e22764d79e42345d512216f07880fdd8db2edf2 (diff) | |
download | usurpation-3397ca1e68f69259cca56751af73f3f0706b6831.tar.gz usurpation-3397ca1e68f69259cca56751af73f3f0706b6831.tar.bz2 usurpation-3397ca1e68f69259cca56751af73f3f0706b6831.zip |
Protocol: updated get_tlv and more docs.
Signed-off-by: Ramūnas Mažeikis <ramunasnezinomas@gmail.com>
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/protocol.c | 2 |
1 files changed, 2 insertions, 0 deletions
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); |