diff options
author | Jakub Jelen <jjelen@redhat.com> | 2019-11-15 12:00:27 +0100 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2019-11-15 14:33:51 +0000 |
commit | af691f98f6209db91348c1e3a553ed58da3ee091 (patch) | |
tree | a368bfb894eb0ba137ef429aef7c7f8495ec5353 /src | |
parent | 43c05401c48d98572c53c92b81237f607f85386d (diff) |
simpletlv: Handle zero-length values in recursive tags
Fixes #4
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/simpletlv.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/simpletlv.c b/src/simpletlv.c index 410a812..0d7f72d 100644 --- a/src/simpletlv.c +++ b/src/simpletlv.c @@ -82,6 +82,8 @@ simpletlv_encode_internal(struct simpletlv_member *tlv, size_t tlv_len, int expect_len = 0, rv; expect_len = simpletlv_get_length(tlv, tlv_len, buffer_type); + if (expect_len == 0 && newptr != NULL && out != NULL) + *newptr = *out; /* Corner case for zero-length values */ if (expect_len <= 0) return expect_len; |